0

如何写动态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:option

还有其他方法吗?

提前致谢。

4

2 回答 2

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"

于 2012-11-22T18:35:21.470 回答
0

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

<html:optionsCollection name="sendEmailForm" property="eventList" label="title" value="eventId" />
于 2010-10-20T04:24:45.463 回答