JSP dynamically generated code, Click Show confirm operation, jump to and pass value according to operation ., Jsp jump

Source: Internet
Author: User

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.