Tuesday, April 23, 2013

dynamic id styleId struts html tag

If you want the html ids to be generated dynamically such as 
<input type="text" name="rule" id="rule0">

check this 
<% int index = 0; %>
<html:text property="rule" styleid='<%="rule"+index%>' />
<% index++;%>

Common mistake:
<html:text property="rule" styleid="rule<%=index%>">
shows up on html,
<input type="text" name="rule" id="rule<%=index%>">



No comments:

Post a Comment