Analyze the example of passing values between JSP pages and jsp
This document analyzes the issue of passing values between JSP pages. We will share this with you for your reference. The details are as follows:
The simplest value is the href value in the <a> label,
Write in a. jsp:
<A href = "B. jsp? Name1 = value "> </a>
Then, receive the following in B. jsp:
<% String name2 = new String(request.getParameter("name1").getBytes("ISO-8859-1"),"GBK"); request.setAttribute("name3",name2);%><input id="id1" value="${name3}"/>
This method is relatively simple, but I also found some problems. For example, it cannot be dynamically loaded. The value is attached when the page is loaded. Let's take an example,
I have a <select> label, which dynamically cascade some provinces and cities, so I want to get the values in <select>, and I cannot use href for them, because I chose the value in <select> to do this after page loading,
<script> var href = "b.jsp?sd="; var getV = function(){ var add = $("#ad").val(); href = href + add; } var h1 = function(){ window.location = href; }</script><select id="ad" onChange="getV()"></select><a id="h" href="#" onClick="hl()" ></a>
I hope this article will help you with JSP program design.
Articles you may be interested in:
- Method for filtering garbled JSP page values
- Application of ajax json value passing Method on jsp page
- Example of ajax value passing in checkbox Using jsp
- Example of how to solve Chinese garbled characters in jsp value passing
- Jquery ajax submits a form from the action to the jsp implementation Summary
- Solve the Problem of garbled characters on the local test machine without garbled characters when passing jsp values
- Two kinds of data transfer between Servlet and JSP