In my situation I was using the Struts logic:iterate tag to display a list of items in a jsp. I finally solved (avoided?) the problem by creating a very simple bean that contained ONLY the ArrayList of the objects I wanted to display and nothing else. With the appropriate getter/setter in place Struts agreed to find the getter method. The class I was using before also had the right getter method, but for some reason, Struts would not see it. There were many other methods in the class, but all the documentation I read indicated it should have worked. I know I am blaming Struts and that might not be fair, but I see a lot of comments about this issue on the message boards.I never found the reason why, but now it works everywhere.
注释不对把
直接把这行删掉看看
<bean:write name="user" property="lName" />..........
</logic:iterate>
</logic:notEmpty >
这样就可以了!
------------------------------
你这里写错了!
<logic:iterate id="alinkman" indexId="ind" name="querylinkmankey" >name属性对应的才是后台传过来的list ,而id属性对应的是当前记录的对象。
name="querylinkmankey"就是存储在session中的arraylist对应的属性名
在后台的语句是:session.setAttribute("querylinkmankey",linkmanList);//linkmanList是arraylist名称
id="alinkman"是我为每个在arraylist中的元素即linkmanBean的取的名字我觉得和楼上各位说的一样,怎么会有错误呢
In my situation I was using the Struts logic:iterate tag to display a
list of items in a jsp. I finally solved (avoided?) the problem by
creating a very simple bean that contained ONLY the ArrayList of the
objects I wanted to display and nothing else. With the appropriate
getter/setter in place Struts agreed to find the getter method. The
class I was using before also had the right getter method, but for some
reason, Struts would not see it. There were many other methods in the
class, but all the documentation I read indicated it should have worked.
I know I am blaming Struts and that might not be fair, but I see a lot
of comments about this issue on the message boards.I never found the reason why, but now it works everywhere.