标签:
1、与普通表单不同之处之基类为
org.apache.struts.action.DynaActionForm
2、与普通表单不同之处之struts-config.xml
<form-bean name="userForm" type="org.apache.struts.action.DynaActionForm" > <!--该表单的属性需要配置如下--> <form-property name="name" type="java.lang.String"/> <form-property name="passwd" type="java.lang.String"/> <form-property name="email" type="java.lang.String"/> </form-bean>
3、访问表单数据不同之处之Action
public ActionForward register(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { DynaActionForm 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"); }
标签:
原文地址:http://www.cnblogs.com/jiqiwoniu/p/4454934.html