Jsp request. getParameter () accepts the form and url data code

Source: Internet
Author: User
Tags server port

The data transmitted by the request. getParameter () method is transmitted from the Web client to the Web server, representing the HTTP request data. The request. getParameter () method returns String-type data.

 

<% @ Page import = "java. util. *" %>
<%
String title = "HttpServletRequest Method Values ";
Map entries = new TreeMap ();
Entries. put ("getCharacterEncoding", request. getCharacterEncoding ());
Entries. put ("getContentLength", "" + request. getContentLength ());
Entries. put ("getContentType", request. getContentType ());
Entries. put ("getLocale", request. getLocale ());
Entries. put ("getProtocol", request. getProtocol ());
Entries. put ("getRemoteAddr", request. getRemoteAddr ());
Entries. put ("getRemoteHost", request. getRemoteHost ());
Entries. put ("getScheme", request. getScheme ());
Entries. put ("getServerName", request. getServerName ());
Entries. put ("getServerPort", "" + request. getServerPort ());
Entries. put ("isSecure", "" + request. isSecure ());
Request. setAttribute ("_ table_title", title );
Request. setAttribute ("_ table_entries", entries );
  
Out. println (request. getCharacterEncoding ());
%>

Request. getParameter () is achieved through the implementation of the container to obtain data transmitted through methods such as post and get.

 

<H1> Request Information </H1>
JSP request method: <% = request. getMethod () %>
<BR>
URL for the request: <% = request. getRequestURI () %>
<BR>
Protocol of the request: <% = request. getProtocol () %>
<BR>
Server name: <% = request. getServerName () %>
<BR>
Path: <% = request. getServletPath () %>
<BR>
Server port: <% = request. getServerPort () %>
<BR>
Remote address: <% = request. getRemoteAddr () %>
<BR>
Remote host: <% = request. getRemoteHost () %>
<BR>
Locale: <% = request. getLocale () %>
<BR>
User agent: <% = request. getHeader ("User-Agent") %>


From get data

<Html>
<Head>
<Title> Retrieving the Original URI </title>
</Head>
<Body>
<Pre>
In ShowPath1.jsp tutorial:

Request. getRequestURI () =
<% = Request. getRequestURI () %>

Request. getServletPath () =
<% = Request. getServletPath () %>

</Pre>
<Jsp: include page = "ShowPath2.jsp" flush = "true"/>
</Body>
</Html>

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.