Struts 1 - 行提交
我在使用 Struts 1 表单时遇到问题,该表单包含一个逻辑:迭代,负责创建行,每行都有一个输入按钮。 当我点击任何一个提交按钮时,就会出现问题,动态数据未正确发布,并且表单没有这些值,这是一个示例:
<html:form action="/myAction" styleClass="centeredForm" style="display:inline" >
<td class="formLabel">City</td>
<td class="formControl">
<bean:define id="cities" name="myForm"
property="cities" type="java.util.Collection"/>
<html:select styleClass="dashSelect" property="city">
<html:option value="">All Cities</html:option>
<html:options collection="cities"
property="id" labelProperty="value"/>
</html:select>
</td>
... Other elements ...
<logic:iterate id="myObject" name="myForm" property="myObjects" indexId="index" type="com.test.MyObject">
<% String rowClass = index.intValue() % 2 == 0 ? "even-row" : "odd-row"; %>
<tr class="<%=rowClass%>">
<td class="result-cell"><bean:write name="myObject" property="id" /> </td>
<td class="result-cell"><bean:write name="myObject" property="name" /> </td>
<td class="result-cell">
<html:select styleClass="dashSelect" name="myObject" property="status">
<html:option value="F">Disabled</html:option>
<html:option value="T">Enabled</html:option>
</html:select>
</td>
<td>
<html:submit/>
</td>
“城市”部分和逻辑之外的其余部分:迭代,在“myForm”上显示得很好,但在“myObject”上则不然。我什至尝试使用 JavaScript 函数提交此内容,但无法使其正常工作。 目前,我所拥有的(我留下作为参考的 html:submit)导致 POST 包含一堆“状态”参数和我之前提到的正确值。
有人能解释一下吗?
如果您需要更多信息,请告诉我。
预先非常感谢!
I'm having an issue with a Struts 1 form, which contains a logic:iterate in charge of creating rows, each with an input button.
The problem comes up when I hit any of those submit buttons, the dynamic data is not properly being posted and the form doesn't have those values, here's an example:
<html:form action="/myAction" styleClass="centeredForm" style="display:inline" >
<td class="formLabel">City</td>
<td class="formControl">
<bean:define id="cities" name="myForm"
property="cities" type="java.util.Collection"/>
<html:select styleClass="dashSelect" property="city">
<html:option value="">All Cities</html:option>
<html:options collection="cities"
property="id" labelProperty="value"/>
</html:select>
</td>
... Other elements ...
<logic:iterate id="myObject" name="myForm" property="myObjects" indexId="index" type="com.test.MyObject">
<% String rowClass = index.intValue() % 2 == 0 ? "even-row" : "odd-row"; %>
<tr class="<%=rowClass%>">
<td class="result-cell"><bean:write name="myObject" property="id" /> </td>
<td class="result-cell"><bean:write name="myObject" property="name" /> </td>
<td class="result-cell">
<html:select styleClass="dashSelect" name="myObject" property="status">
<html:option value="F">Disabled</html:option>
<html:option value="T">Enabled</html:option>
</html:select>
</td>
<td>
<html:submit/>
</td>
The "city" portion and the rest outside of the logic:iterate, come up just fine on "myForm", but "myObject" isn't. I even tried submitting this with a JavaScript function but wasn't able to get it properly working.
Currently, what I have (That html:submit that I left as a reference) causes the POST to contain a bunch of "status" parameters and the proper values that I mentioned before.
Can anyone shed some light onto this?
Let me know if you need further information.
Thanks a lot in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有使用单一表单,而是在逻辑:迭代中使用了一个表单,向相应的属性添加了索引,并使用 Javascript 函数来获取其余内容。
谢谢!
Instead of using one single form, I've just used a form inside the logic:iterate, added indexes to the corresponding properties and used a Javascript function to obtain the rest.
Thanks!
逻辑迭代:尝试这样做可能会对您有所帮助。
Logic Iterate: Try do this way It may be help you.