In this paper, we analyze the problem of passing values between JSP pages. Share to everyone for your reference, specific as follows:
One of the simplest to count the number <a> tags inside the href to pass the value,
Write in a.jsp:
<a href= "b.jsp?name1= value" ></a>
Then receive 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, such as not dynamic loading, he is loaded in the page when the value is appended to it, for example,
I have a <select> tag, which is a dynamic cascade of some provinces and cities, then I want to take the value of <select> inside, can not be used to preach with href, because I choose <select> the value is in the page after the completion of the load , the individual is doing this,
<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.