Analyze the example of passing values between JSP pages and jsp

Source: Internet
Author: User
Tags getv

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

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.