JSP review (Part 2)

Source: Internet
Author: User

3.4.2 Access (GET) Request parameters

1. Methods

String string variable =request.getparameter ("Name property name of the client-supplied parameter");

2. Three forms of parameter transmission

(1) Forward and include actions using JSP

(2) in a JSP page or HTML page

(3) Append the parameters after the URL to pass or append the hyperlink behind the hyperlinks

Code Exercise: 3-8

<body>

<% String current param = "";

String current_vaul= "";

Request.setcharacterencoding ("UTF-8");

Enumeration Params=request.getparameternames ();

while (Params.hasmoreelements ()) {

Current_param= (String) params.nextelement ();

Current_vaul=request.getparameter (Current_param)

%> parameter name:<%=current_param%> parameter value;<%=current_vaul%><br>;

<%}%>

</body>

3.4.3 setting and fetching of new properties

Using the setattribute ("name", obj) method of the Request object on the page, you can set the data obj within the request scope (container), and the requested forwarded page uses getattribute ("name") to

Gets the value of the data obj.

Set data format: void Request.getattribute (String name);

Get data Format: Object Request.getattribute (String name);

JSP review (Part 2)

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.