id="subscription" 这里的ID实际标识了<logic:iterate >整一个一段里引用LIST里元素的名字,你要改的话,必须整个一段里面都改才行。<logic:iterate id="dictionaryGroup" name="hash_dicGroup_key" >
<tr>
<td align="left">
<bean:write name="dictionaryGroup" property="name" />
</td>
<td align="center">
<bean:write name="dictionaryGroup" property="tableName" />
</td>
<td align="center">
<bean:write name="dictionaryGroup" property="description"/>
</td>
</tr>
</logic:iterate>
这一段东西好象没有错,你说不行,报的错是什么呢?
name,tableName,description这几个属性,你的BEAN里是不是有呢?
<tr>
<td align="left">
<bean:write name="dictionaryGroup" property="name" />
</td>
<td align="center">
<bean:write name="dictionaryGroup" property="tableName" />
</td>
<td align="center">
<bean:write name="dictionaryGroup" property="description"/>
</td>
</tr>
</logic:iterate>
这一段东西好象没有错,你说不行,报的错是什么呢?
name,tableName,description这几个属性,你的BEAN里是不是有呢?
你的问题解决如下:
你先定义一个FormBean.java 这个类里面声明host,username,等的access(set和get)方法
现在你从数据库中检索出来的结果都转换成每一条纪录对应一个FormBean对象,这样你就得到了一个FormBean数组。最后在你的Action中将这个数组放到session中,比如session.setAttribute("FormBean",myFormBeanArray);在jsp端:<logic:iterate id="subscription" name="FormBean" type="packageName.FormBean">
<tr>
<td align="left">
<bean:write name="subscription" property="host" filter="true"/>
</td>
<td align="left">
<bean:write name="subscription" property="username" filter="true"/>
</td>
<td align="center">
<bean:write name="subscription" property="type" filter="true"/>
</td>
<td align="center">
<bean:write name="subscription" property="autoConnect"/>
</td>
</tr>
</logic:iterate>这样就可以了
id="subscription" ,我对整一段都改了,都不行,修改后如下:你可试试!
<logic:iterate id="subscription1" name="user" property="subscriptions">
<tr>
<td align="left">
<bean:write name="subscription1" property="host" filter="true"/>
</td>
<td align="left">
<bean:write name="subscription1" property="username" filter="true"/>
</td>
<td align="center">
<bean:write name="subscription1" property="type" filter="true"/>
</td>
<td align="center">
<bean:write name="subscription1" property="autoConnect"/>
</td>
<td align="center">
<app:linkSubscription page="/editSubscription.do?action=Delete">
<bean:message key="registration.deleteSubscription"/>
</app:linkSubscription>
<app:linkSubscription page="/editSubscription.do?action=Edit">
<bean:message key="registration.editSubscription"/>
</app:linkSubscription>
</td>
</tr>
</logic:iterate>
错误是:没有找到 dictionaryGroup的 getter方法。
“name,tableName,description这几个属性,你的BEAN里是不是有呢?”
我的Class,及属性,getter,setter方法都有,因为我用java代码已经可以读出,如贴子中间那段java代码。
Iterator, Map, or Array—and evaluates its bodyHashtable 可能不行