strus标签使用时如何把简单List的值写回FORM中

abwentin 2008-02-28 10:03:03
在FORM中定义了两个List
list<Option> optionList = new ArrayList<Option>();
List<String> strList = new ArrayList<String>();

在JSP里想把以上两人LIST的值写回FORM中,optionList的写法应该是:
<logic:iterate name="form" propety="optionList" id ="lista" index="optionIndex">
<html:hidden name="lista" property="label" indexed="true" />
<html:hidden name="lista" property="value" indexed="true" />
</logic:iterate >

那strList里每一个结点的值怎么写回FORM呢?

...全文
135 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
abwentin 2008-03-06
  • 打赏
  • 举报
回复
到底怎么写呢?
cd_tiger 2008-03-06
  • 打赏
  • 举报
回复
没玩过struts2也没关系,
在我的记忆中struts1自定义一个带数组属性的formBean,这样就OK拉!动态formBean好象无法定义数组或集合什么的!
abwentin 2008-03-06
  • 打赏
  • 举报
回复
action 里定义LIST? 没接触过struts2
cd_tiger 2008-03-06
  • 打赏
  • 举报
回复
建议你用struts2吧,直接在action里定义list就轻松搞定拉!
abwentin 2008-03-06
  • 打赏
  • 举报
回复
<logic:iterate name="form" propety="String" id ="listStr" index="strIndex">
<html:hidden name="listStr" property?= ??? indexed="true" />

属性值写什么?
abwentin 2008-03-06
  • 打赏
  • 举报
回复
老大们呐, 我是很新手的,能不能给个代码示范一下?
太空眼睛 2008-03-06
  • 打赏
  • 举报
回复
用个动态表单也行.
abwentin 2008-02-28
  • 打赏
  • 举报
回复
UP!

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧