动态struts <html:option> </html:option>

时间:2010-10-20 03:39:45

标签: html struts option

如何编写动态struts <html:option>,我正在做如下

<logic:iterate id="data" name="sendEmailForm" property="eventList">
    <html:option value="<bean:write name="data" property="eventId"/>"/>
        <bean:write name="data" property="title"/>
    </html:option>
</logic:iterate>

但是收到以下错误:

  

JSPG0069E:解析jsp时找到不匹配的结束标记。期待   逻辑:迭代在[87,130]

找到html:选项

还有另一种方法吗?

提前致谢。

2 个答案:

答案 0 :(得分:3)

<html:option property="title">
<html:optionsCollection name="sendEmailForm" label="title" value="eventId" />
<html:option>
  1. html:选项标记

    property="?"无论你想设置什么,如果属性是标题和相应的方法(getTitle()setTitle(String title)),那么property= "title"

  2. html:optionsCollection标记

    • name = "?"您在请求/会话属性中添加的内容 像(request Or session).setAttribute("sendEmailForm", ListArr); 然后name =“sendEamilForm”

      • listArr是bean的对象数组(可能是formbean或简单的pojofile / bean)。
    • label ="?"您希望展示的内容,如果您有属性'title'和 然后是相应的setter(setTitle(String title))和getter(getTitle())方法 label="title"

    • value ="?"您希望将哪个值作为选项中的值。你打电话给你的getter方法 相应的属性,如果你有属性eventId和方法( setEventId(String eventId) , getEventId())然后value="eventId"

答案 1 :(得分:0)

好吧最后我在下面找到了解决方案

<html:optionsCollection name="sendEmailForm" property="eventList" label="title" value="eventId" />