Today I encountered a very strange problem.
The Red Section in the following code defines a button.
<Logic: notempty name = "labexamineform" property = "examineresultlist">
<% Int rowcount = 0; %>
<Logic: iterate id = "result" name = "labexamineform" property = "examineresultlist">
<Tr bgcolor = "# f3fbff" id = "result_table <% = rowcount %>">
<TD>
<Div align = 'center'> & nbsp; <Bean: write name = "result" property = "name"/> </div>
</TD>
<TD>
<Div align = 'center'> & nbsp; <Bean: write name = "result" property = "item"/> </div>
</TD>
<TD>
<Div align = 'center'> & nbsp; <Bean: write name = "result" property = "result"/> </div>
</TD>
<TD>
<Div align = 'center'> & nbsp; <HTML: button property = "delbutton" value = "delete" onclick = "delrow ('result _ TABLE <% = rowcount %> ')"/> </div>
</TD>
</Tr>
<% Rowcount ++; %>
</Logic: iterate>
</Logic: notempty>
There is a JSP value statement (orange part)
However, this <% = rowcount %> is not parsed every time you access this page, so that the red HTML code in the page source file is like this (<% = rowcount %> ') "directly appears in the source file)
<Input type = "button" name = "delbutton" value = "delete" onclick = "delrow ('result _ TABLE <% = rowcount %> ')"/>
When I tried a variety of methods, I suddenly thought that the struts tag <HTML: button is to be re-translated by the server. Will this cause a problem?
Change the red part to <input type = "button"
Finally, it works properly. The red part of the page source file is correctly parsed
<Input type = "button" name = "delbutton" value = "delete" onclick = "delrow ('result _ table0')"/>
I have never encountered this problem before and do not know whether it is a bug.
The preceding figure shows that struts labels are not needed when JSP code is added.
<Input type = "button" name = "delbutton" value = "delete" onclick = "delrow ('result _ TABLE <% = rowcount %> ')"/>