JSP dynamically generated code, Click Show confirm operation, jump to and pass value according to operation ., Jsp jump
If the following code generates multiple options, how can we obtain the value in the click Delete item?
<%
List <Theme> themelist = (List <Theme>) request. getAttribute ("topicList ");
If (themelist! = Null ){
For (Theme theme: themelist ){
%>
<Li> <% = theme. getThemeName () %> & nbsp; <
Href = "topic_modify.jsp? Tname = <% = theme. getThemeName () %> & tid = <% = theme. getTid () %> "> modify </a>
& Nbsp; <
Href = "#"
Onclick = "forward ('<% = theme. getThemeName () %> ',' <% = theme. getTid () %> ') "> Delete </a> </li>
<%
}
}
%>
We can add an onclick event to the Tag Element, create a function, and set parameter passing during dynamic generation. Note that parameters must be enclosed in quotation marks, otherwise they will be considered as variables, the click event is invalid.
The function can be written as follows:
The source code queried on the webpage is as follows:
However, writing in this way may have some drawbacks. You can select one based on your situation, or you can set to directly jump to the tag and append elements to it.