Class FormTemplate
java.lang.Object
sunlabs.brazil.template.Template
sunlabs.brazil.template.FormTemplate
- All Implemented Interfaces:
TemplateInterface
- Direct Known Subclasses:
FormHelpTemplate
Template class for substituting default values into html forms.
This class is used by the TemplateHandler.
The default values in form elements are replaced by the request property that
matches the field name. The following field elements are processed:
- <input name=x value=y>
- <input type=input name=x value=y>
- <input type=radio name=x value=y>
- <option value=x>
value attribute must be present.
additional information is provided below.
If the enclosing <form> tag has the attribute "prepend", then "prepend" is tacked on the front of each variable name before its value is looked-up. The "prepend" attribute is then removed from the form tag.
- Version:
- @(#)FormTemplate.java 2.4
- Author:
- Stephen Uhler
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandone(RewriteContext hr) This is for debugging only !!booleaninit(RewriteContext hr) Save a reference to our request properties.voidLook for a "prepend" attrubute, remember its value, then remove it from the tag.voidLook for <input name=[x] value=[v]> and replace the value with the entry in the request properties.voidLook at the option tag, set the "selected" attribute as needed.voidRemember the variable name for the next group of option tags.voidForget about the "prepend" valuevoidForget the variable name for the next group of option tags
-
Constructor Details
-
FormTemplate
public FormTemplate()
-
-
Method Details
-
init
Save a reference to our request properties.- Specified by:
initin interfaceTemplateInterface- Overrides:
initin classTemplate
-
tag_form
Look for a "prepend" attrubute, remember its value, then remove it from the tag. -
tag_slash_form
Forget about the "prepend" value -
tag_input
Look for <input name=[x] value=[v]> and replace the value with the entry in the request properties. If no value is supplied, no substitution is done. Ifvaluecontains any ${..} constructs, the substituted value is used instead of the value in the corrosponding request property. -
tag_select
Remember the variable name for the next group of option tags. -
tag_slash_select
Forget the variable name for the next group of option tags -
tag_option
Look at the option tag, set the "selected" attribute as needed. In order for this to work, the VALUE tag *must* be used Do ${...} substitutions on the value. -
done
This is for debugging only !!- Specified by:
donein interfaceTemplateInterface- Overrides:
donein classTemplate
-