JSP: how to pass dynamic offset value to struts logic:iterate tag in a jsp page.
Problem Scenario:
Using <logic:iterate> tag in a JSP page, we need to pass a dynamic value for its length or offset, like this:
<bean:write name="element" property="value" offset="offsetValue" length="lengthValue"/>
where offsetValue and lengthValue are not pre-defined.
Solution:
The real problem I encountered was the parsing error since both <% %> quote and struts tags are server-side. Using single quote for logic:iterate offset attribute and double quotes for request.getAttribute, as below:
<%request.setAttribute("offset","1");%>
<logic:iterate name="serverTypes" id="serverType" offset='<%=(String)request.getAttribute(
<bean:write name="serverType"/>
</logic:iterate>
0 Comments:
Post a Comment
<< Home