JAVA Web Request Object

Source: Internet
Author: User

Request Object

The request object is used to handle the parameters of the request in HTTP, and the most common is to get the requested parameters. If you want to specify multiple parameters at the same time, the use of the parameters between the (&) is delimited

Example gets the passed parameter value code by using the GetParameter () method of the request object as follows

The index page is used to connect to the delta

<%@ page language= "java" contenttype= "text/html; charset=gb18030 "pageencoding=" GB18030 "%>


<meta http-equiv= "Content-type" content= "text/html; charset=gb18030 ">
<title> use the Request object to get the requested parameter value </title>

<body>
<a href= "deal.jsp?id=1&user=" > Processing page </a>

<--This specifies the parameter name and value for the ID, and the user specifies that the character parameter name does not specify the argument value--
</body>

Note: When the request's GetParameter method gets the passed argument, if the specified argument does not exist, NULL is returned, the parameter name is specified but no argument is specified, and an empty string "" is returned.

Delete Page

<%@ page language= "java" contenttype= "text/html; charset=gb18030 "pageencoding=" Utf-8 "%>
<%


String id=request.getparameter ("id");//Gets the value of the ID parameter
String user=request.getparameter ("user");//Gets the value of the user parameter
String pwd=request.getparameter ("pwd");//get pwd parameter value
%>


<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title> Processing Pages </title>

<body>
The value of the ID parameter is: <%=id%><br>
The value of the user parameter is: <%=user%><br>
The value of the PWD parameter is: <%=pwd%>
</body>

JAVA Web Request Object

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.