[英]Error while using Iterator in struts 2
I am having an iterator and I am trying to dynamically name the ids 我有一个迭代器,并且试图动态命名ID
<s:iterator value="roleScreenDetailsList" status ="itemIndex">
<table>
<tr class="normRow" id="row_<s:property value="#itemIndex.count"/>" style="display:none;">
<td colspan="8" class="bdr0">
<s:textfield name="roleDescription" cssClass="txtboxDIS" id="Desc_<s:property value="#itemIndex.count"/>" size="30" disabled="true" />
</td>
</table>
</s:iterator>
In the above code , the table row , with class ="normRow" has proper ids generated , but in case of the text field , I am getting the following error 在上面的代码中,具有类=“ normRow”的表行已生成正确的ID,但是在文本字段的情况下,出现以下错误
org.apache.jasper.JasperException: /WEB-INF/jsp/screens/role.jsp(150,102) Unterminated <s:textfield tag
Am I missing something ? 我想念什么吗?
<s:iterator value="roleScreenDetailsList" status ="itemIndex">
<table>
<tr id="row_${itemIndex.count}">
<td><s:textfield name="roleDescription" id="Desc_%{#itemIndex.count}" /></td>
</tr>
</table>
</s:iterator>
Just try something like 只是尝试像
<s:iterator value="roleScreenDetailsList" status ="itemIndex">
<table>
<tr class="normRow" id="row_<s:property value="#itemIndex.count"/>" style="display:none;">
<td colspan="8" class="bdr0">
<s:textfield name="roleDescription" cssClass="txtboxDIS" id='Desc_<s:property value="#itemIndex.count"/>' size="30" disabled="true" />
</td>
</table>
</s:iterator>
Custom jsp tags are not evaluated inside attributes of other jsp tags. 自定义jsp标记不在其他jsp标记的属性内进行评估。 A scriptlet however should work in this case:
但是,在这种情况下,脚本应该可以工作:
<s:textfield name="roleDescription" cssClass="txtboxDIS"
id='Desc_<%= ((org.apache.struts2.views.jsp.IteratorStatus)pageContext.findAttribute("itemIndex")).getCount() %>'
size="30" disabled="true" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.