< html:form /> html tag

< html:form /> html tag

Previous Home Next

 

The struts form tag (<html:form>) is a render of a html <form> tag. Like html form tag struts form tag is have many child tags (e.g.<html:button>etc.) which must be nested into
  • <html:form></html:form>

 
This html<form>element whose contents are described by the body content of this tag.The form implicitly interacts to the namedActionFormbean which is specified session scope or request scope bean to populatethe input fields with the current property values.The form bean is located and created based on the form bean specification for the associatedActionMapping.

The Struts form tag also links the JSP with Java Form Bean(subclass of ActionForm in Struts) to gather data.The following struts form tag is :-

Action:- Maps to the<action>tag that will carry out the user’s request when the form data is submitted. This is a required field. Here action attribute is used to carry the forms data when user click on submit button.<action></action>
The child tags of Strut HTML Form tag :- 
  • <html:button>  
  • <html:cancel> 
  • <html:checkboxes> 
  • <html:file> 
  • <html:hidden> 
  • <html:image> 
  • <html:multibox>  
  • <html:password>  
  • <html:radio>  
  • <html:reset>
  • <html:select> 
  • <html:option> 
  • <html:options> 
  • <html:submit> 
  • <html:text> 
  • <html:textareas> 

Following are more other attributes of Struts Form tag:-

  • <html:form></html:form>
  • <html:text></html:text> 
  • <html:submit></html:submit> 
  • <html:options></html:options>
  • <html:option></html:option> 
  • <html:textareas></html:textareas> 
  • <html:select></html:select> 
  • <html:reset></html:reset> 
  • <html:radio></html:radio> 
  • <html:password></html:password> 
  • <html:multibox></html:multibox> 
  • <html:image></html:image> 
  • <html:hidden></html:hidden> 
  • <html:file></html:file> 
  • <html:checkboxes></html:checkboxes> 
  • <html:cancel></html:cancel> 
  • <html:button></html:button> 
  • </html:action><html:action>

1.Action:- This is URL where form will be submitted. This is used to call actions and action form.This value is also used to select the ActionMapping we are assumed to be processing

2.Method: Set how we have send the forms data use POST or GOT method .

3.Disabled: This attributes is used to set either to disable the input fields or not.

4.Dir :This is used to direction for weak/neutral text for this element.

5.OnSubmit :- This attributes is used when the form is submitted after that event handler executed.

6.Onreset :-This attributes is used when the form is reset after that event handler executed.

The Following are many other attributes which we can use : 
  • acceptCharset
  • enctype
  • focusIndex 
  • lang 
  • scriptLanguage
  • style 
  • styleClass 
  • styleId

Previous Home Next