An example of the problem of JSP page transfer between pages _jsp programming

Source: Internet
Author: User
Tags getv

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.

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.