1. The base class is different from the ordinary form
Org.apache.struts.action.DynaActionForm
2, different from the ordinary form of the Struts-config.xml
<Form-beanname= "UserForm"type= "Org.apache.struts.action.DynaActionForm" > <!--the properties of this form need to be configured as follows - <Form-propertyname= "Name"type= "Java.lang.String"/> <Form-propertyname= "passwd"type= "Java.lang.String"/> <Form-propertyname= "Email"type= "Java.lang.String"/> </Form-bean>
3. Access the form data different action
public Actionforward Register ( actionmapping mapping, Actionform form, httpservletrequest request, httpservletresponse response) {Dyna Actionform userForm = (dynaactionform) Form; // TODO auto-generated Method stub // String name = userform.getstring ("name" ); String Password = userform.getstring ("passwd" ); String Email = userform.getstring ("email" ); SYSTEM.OUT.PRINTLN (name + ":" + password + ":" + email); return mapping.findforward ("OK"
Dynamic form of struts learning