Struts中jsp页是怎么与ActionForm关联起来的,我始终找不到有什么代码把它们两个连接起来的. 在struts-config.xml中每个对应的action有一个对应的actionform是这样对应的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ActionForm就是一个Bean,一般在.xml文件中配置,但JSP中也不是只能用.xml文件中配置了的Bean,就象一个普通的JSP文件一样,可用到其它的Bean,它主要就是用于保存数据。在Struts中也可以用非ActionForm扩展的Bean.只是不能用到ActionForm的一些特性,如数据验证,出错处理等. http://www.ninsky.com/struts/index.html上面例子里的源代码相信说得很清楚 但是struts-config.xml中这么多BEAN怎么确实这JSP页面与哪个BEAN作互映射呢 Struts是这样认为的:如果一个JSP页面里有Form元素,就认为这个Form元素对应着一个JAVABEAN,这个JAVABEAN在Struts中叫做FormBean,关于如何对应,就是在struts-config.xml中设置了,一个Formbean的名字对应一个javabean类(FormBean),用标签引用<html:form property=FormBean名字>这样就对应起来了 <html:form name="fileForm" type="origin.weather.actionform.FileForm" method="post" action="fileSearchAction.do" onsubmit="return validateFileForm(this);"> 再jsp文件中:又一句<html:form action="insertAdmin" focus="name" method="post">在struts-config.xml中,相应的有配置:<form-beans> <form-bean name="adminUserForm" type="xxxxx.struts.AdminActionForm" />/////////////这里保存adminUserForm的绝对路径,通过这个得到form的路径</form-beans><action path="/insertAdmin" type="xxxxx.struts.AdminAction" name="adminUserForm" scope="request"> <forward name="success" path="/do/listAllAdmins"/></action>在这个.xml文件中,type的值就是这个insertAdmin(映射)的绝对路径,name的值就是ActionForm,保存页面from要提交处理的所有信息 是通过<html:form>这个标签来映射的。这个标签又一个action属性,通过这个action属性到struts-config的action-mappings里面找到相应的action的。而action-mappings里面定义的action都有name这个属性的,这个就是关联到具体的ActionForm的。 书店的登陆和注册功能怎么实现 java webservice 开启https单向认证异常 MyEclipse6.5的注册机在哪里下载? MyEclipse6.0 使用Tomcat做struts是报错 求救:关于LINUX9+tomcat4.1.29下面的读取中文字符串响应乱码问题!! word文档的处理 兄弟们,找银行要接口(网上支付),好要吗? 我想做一个在启动web应用程序的时候就开始运行的servlet spring bean生命周期 JCreator如何 debug 如何用request传递二维数组
<html:form action="insertAdmin" focus="name" method="post">在struts-config.xml中,相应的有配置:
<form-beans>
<form-bean name="adminUserForm" type="xxxxx.struts.AdminActionForm" />/////////////这里保存adminUserForm的绝对路径,通过这个得到form的路径
</form-beans>
<action path="/insertAdmin" type="xxxxx.struts.AdminAction" name="adminUserForm" scope="request">
<forward name="success" path="/do/listAllAdmins"/>
</action>在这个.xml文件中,type的值就是这个insertAdmin(映射)的绝对路径,name的值就是ActionForm,保存页面from要提交处理的所有信息