严格控制在Controll里
jsp里用<bean:write name="" property=""/>体现
前面还得加上<logic:iterate name="" property=""/>
jsp里用<bean:write name="" property=""/>体现
前面还得加上<logic:iterate name="" property=""/>
解决方案 »
- 项目中不要的垃圾文件太多,但是又没办法确认哪些文件是不要的。怎么删除这些文件呢?
- 动态修改WebService的URL
- 想用hql查询出一个date字段的日期为今天日期的记录
- oracle中写 '= null'会怎么处理
- LOG4J如何能实现stdout为INFO,fileappender为ERROR
- 文件上传浏览问题
- 专程送分(100)
- There is no Action mapped for namespace [/user] and action name [adduser!add]
- 千分求助:jbuilder2005 + jboss + mssql2000,用ejb技术。
- tomcat下工程移植到weblogic下出错
- Tomcat4.0+struts1.1如何进行安装配制
- 请教一个struts和自定义标签结合起来使用的问题
说得再详细一点好吗?我也想知道 !
<bean:write name="curObjId" property="yourProperty"/>
</logic:iterate>
然后 通过 rs 的赋值 。
最后把那些 DataObject 依次放入 Vector 里。
然后在jsp上:
<logic:present name="yourActionFormName" property="yourVectorName">
<logic:iterate id="aDataName" name="yourActionFormName" property="yourVectorName">
<bean:write id="aDataName" property="value"/>
</logic:iterate>
</logic:present>
不知道是否对你有帮助?
that can be used for this purpose, if you're using Struts 1.1.
Basically, there's now a really simple way to copy the contents of a
ResultSet into a list of DynaBeans. This really is a *copy* operation,
so you have to pay some performance and memory cost, but it lets you
pass the data without having to create custom beans, and without leaving
the ResultSet open.You'll need to grab a very recent nightly build of commons-beanutils
from:
http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-beanuti
lsand replace your commons-beanutils.jar file if you want to try this.> Please include the .java and .jsp code.
>In your Java code, you'd do something like this:Connection conn = ...; // Get connection from the pool
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select custid, name from
customers");
RowSetDynaClass rsdc = new RowSetDynaClass(rs);
rs.close();
stmt.close();
... return connection to the pool ...
request.setAttribute("custoemrs", rsdc.getRows());In your JSP page, treat this List of DynaBeans like you would any other
collection of beans, because all the Struts tags know how to deal with
DynaBeans.<table>
<tr>
<th>Customer ID</th>
<th>Customer Name</th>
</tr>
<logic:iterate name="customers" id="customer">
<tr>
<td><bean:write name="customer" property="custid"/></td>
<td><bean:write name="customer" property="name"/></td>
</tr>
</logic:iterate>
</table>See the updated Javadocs for commons-beanutils (included in the binary
distribution) for class org.apache.commons.beanutils.RowSetDataSource
for more information about this class.Craig