| 
						 
							To use the Form Tags on a einer JSP Page, the corresponding tag library has
							to be declared at the start of the page. Then, the form elements can be referenced
							with the prefix <forms:tagname />. [In addition, the
							tag libraries must be included in the Deployment descriptor, the WEB-INF/web.xml file]
							 
							Our form also contains, apart from input fields and selection boxes, a section for
							the grouping of information and a button bar. The required elements are defined with
							the following tags:
						 
    | Tag | 
    Description | 
 
    | <forms:form/> | 
    Defines the form. The title is defined | 
 
    | <forms:plaintext/> | 
    Serves for editing text | 
 
    | <forms:text/> | 
    Generates an input field. The Required attribute serves to mark the mandatory fields. | 
 
    | <forms:select/>	 | 
    Defines a selection box | 
 
    | <forms:options/>	 | 
    Defines an option list for a selection box | 
 
    | <forms:section/>	 | 
    Defines and draws a section | 
 
    | <forms:buttonsection/>	 | 
    Defines a button bar and specifies a default button | 
 
    | <forms:button/>	 | 
    Defines and draws a button | 
 
    | <forms:message/>	 | 
    Draws a message dialog. The dialog is classified as an error dialog using the attribute severity="error". | 
 
 
<%@ taglib uri="/WEB-INF/struts-html.tld"       prefix="html" %> 
<%@ taglib uri="/WEB-INF/tlds/cc-forms.tld"     prefix="forms" %> 
<%@ taglib uri="/WEB-INF/tlds/cc-controls.tld"  prefix="ctrl" %> 
 
<forms:message caption="Error" severity="error"/> 
 
<html:form action="/sample101/userEdit"> 
    <forms:form type="edit" caption="User - Edit" formid="frmEdit"> 
        <forms:plaintext 
            label="User-Id" 
            property="userId"/> 
 
        <forms:text 
            label="First-Name" 
            property="lastName" 
            size="45" 
            required="true"/> 
 
        <forms:text 
            label="Last-Name" 
            property="firstName" 
            size="45" 
            required="true"/> 
 
        <forms:select 
            label="Role" 
            property="rolekey"> 
            <ctrl:options property="roleOptions"/> 
        </forms:select> 
 
        <forms:text 
            label="eMail" 
            property="email" 
            size="45"/> 
 
        <forms:text 
            label="Phone" 
            property="phone" 
            size="25" /> 
 
        <forms:section title="Address"> 
            <forms:text 
                label="Street" 
                property="street" 
                size="45"/> 
            <forms:text 
                label="Number" 
                property="streetnumber" 
                size="5"/> 
            <forms:text 
                label="ZipCode" 
                property="zipcode" 
                size="5"/> 
            <forms:text 
                label="City" 
                property="city" 
                size="25"/> 
 
            <forms:select 
                label="Country" 
                property="countrycode"> 
                <ctrl:options 
                    property="countryOptions" 
                    labelProperty="country"/> 
            </forms:select> 
        </forms:section> 
 
        <forms:buttonsection default="btnSave"> 
            <forms:button name="btnBack" 
                src="btnBack1.gif"/> 
            <forms:button name="btnSave" 
                src="btnSave1.gif"/> 
        </forms:buttonsection> 
    </forms:form> 
</html:form> 
 
The <forms>-tag in our example is embeded in a Struts <html:form/>-tag. Thus, with the specified action
(/sample101/userEdit) it gets access to the Form-Bean, which provides the display data.
The <forms>-tag can also be used alone without Struts <html:form/>-tag; however, then, the action
attribute must be given additionally. 
All tags of the Common Controls library work, if required, in conjunction with the Struts tags!
                   
                    back   |  
                    continue to step 5   
								 |