http://hi.baidu.com/kootao/blog/item/432125d1cfe13b389a5027f2.html
JSP页面通过Form控制Beans属性
这个问题我曾经在社区提问过,不知是当时没问清楚还是怎样,回答是不能控制,原因是JSP是在客户端,而Beans在服务器端,后来得到一同事的指点,这个问题得以解决。
JSP:
<logic:present name="form" property="list">
<logic:iterate id="name" name="form" property="list">
<td><html:text name="name" property="beanValue1" indexed="true" /></td>
<td><html:text name="name" property="beanValue2" indexed="true" /></td>
</logic:iterate>
</logic:present>
Form:
private List list;
getter & setter methods;
public Bean getName(int index) {
return (Bean ) (list.get(index));
}
Bean:
public class Bean {
private String beanValue1;
private String beanValue2;
getter & setter methods;
}
通过以上几行几行简单的代码即可实现JSP对Bean的控制,这样可以简化很多工作量
分享到:
相关推荐
<form-beans> <form-bean name="loginForm" type="test.form.LoginForm"/> </form-beans> − − <action attribute="loginForm" input="/login.jsp" name="loginForm" path="/login" scope="request" type="test....
<form-beans> <form-bean name="actionForm" type="org.apache.struts.action.DynaActionForm"> <form-property name = "filedata" type = "org.apache.struts.upload.FormFile" /> </form-bean> </form-...
<form-beans> <form-bean name="LoginForm" type="com.yza.struts.form.LoginForm"></form-bean> </form-beans> scope="request" input="/index.jsp"> <forward name="success" path="/success....
<form-beans > <form-bean name="testForm" type="com.yourcompany.struts.form.TestForm" /> <form-bean name="test1Form" type="com.yourcompany.struts.form.Test1Form" /> <form-bean name="test2Form" type...
input="/add.jsp" --错误时跳转的页面 name="addForm" --Frombean的名字 path="/add" --路径 scope="request" --作用域 type="com.lmf118.struts.action.AddAction"> ...
next3: struts控制器根据name="HelloForm"找<form-beans>中对应的<form-bean> next4: <form-bean>调用指定的type类 关联: 如果validate是"true"那么调用type类的validate(); next5: struts控制器在HelloForm bean...
在知识的讲解上,本书采用理论与实践相结合的方式,从程序运行的内部机制进行分析讲解,并通过大量的实例和实验来验证并运用本书的知识。.. 本书语言生动、通俗易懂、讲解细致,大部分章节都提供了多个例子,而且很...
在知识的讲解上,本书采用理论与实践相结合的方式,从程序运行的内部机制进行分析讲解,并通过大量的实例和实验来验证并运用本书的知识。.. 本书语言生动、通俗易懂、讲解细致,大部分章节都提供了多个例子,而且很...
在知识的讲解上,本书采用理论与实践相结合的方式,从程序运行的内部机制进行分析讲解,并通过大量的实例和实验来验证并运用本书的知识。.. 本书语言生动、通俗易懂、讲解细致,大部分章节都提供了多个例子,而且很...
在知识的讲解上,本书采用理论与实践相结合的方式,从程序运行的内部机制进行分析讲解,并通过大量的实例和实验来验证并运用本书的知识。.. 本书语言生动、通俗易懂、讲解细致,大部分章节都提供了多个例子,而且很...
Handling Request Parameters with Form Beans Section 10.6. Prepopulating and Redisplaying Input Forms Chapter 11. The Struts Framework: Doing More Section 11.1. Using Properties Files Section 11.2...
WEB-INF下的applicationContext.xml为Spring的配置文件,struts-config.xml为Struts的配置文件,file-upload.jsp为文件上传页面,file-list.jsp为文件列表页面。 本文后面的章节将从数据持久层->业务层->Web层的...
Handling Request Parameters with Form Beans Section 10.6. Prepopulating and Redisplaying Input Forms Chapter 11. The Struts Framework: Doing More Section 11.1. Using Properties Files Section 11.2...
7.A better way to seperate Book and BookForm 8.Handling Invalid Entries 9.Recapitualation: Where we are 10.Using Logic 11.Templates 12.FAQ 13.Beans to XML 14.Replacing JSP with XSLT ...
分离Book和BookForm的一个好方法 08. 处理Invalid Entries 09. Recapitualation: Where we are 10. 使用logic 11. Templates 12. FAQ 13. Beans to XML 14. Replacing JSP with XSLT 15. 介绍AspectJ ...
另外,Struts还提供了一系统实用对象:XML处理、通过Java reflection APIs自动处理JavaBeans属性、国际化的提示和消息等。 <br/> 7、一个实例 <br/> 一个用户注册系统,用户通过网页输入相关信息...
9 </form-beans> 10 11 12 13 14 <action attribute="LoginForm" input="/login.jsp" name="LoginForm" path="LoginAction" scope="request" type="com.test.web.action.LoginAction" validate="true"> 15 ...
7.7. 使用ProxyFactory通过编程创建AOP代理 7.8. 操作被通知对象 7.9. 使用“自动代理(autoproxy)”功能 7.9.1. 自动代理bean定义 7.9.1.1. BeanNameAutoProxyCreator 7.9.1.2. DefaultAdvisorAutoProxyCreator ...
07.分离Book和BookForm的一个好方法 08.处理Invalid Entries 09.Recapitualation: Where we are 10.使用logic 11.Templates 12.FAQ 13.Beans to XML 14.Replacing JSP with XSLT 15.介绍AspectJ 16.用...
form标签 13.9.3. input标签 13.9.4. checkbox标签 13.9.5. checkboxes标签 13.9.6. radiobutton标签 13.9.7. radiobuttons标签 13.9.8. password标签 13.9.9. select标签 13.9.10. option标签 13.9.11. ...