Jsp9 large built-in objects and scopes

Source: Internet
Author: User

Jsp9 large built-in objects and scopes

1. el: Get the parameter value $ {param. id} in the url}

2. el built-in objects

PageContext, pagination, requestScope, sessionScope, applicationScope, param, paramValues, header, headerValues, cookie, initParam

3. el built-in Object Classification

3.1 implied objects related to the scope: pagination, requestScope, sessionScope, and applicationScope

A. built-in objects equivalent to jsp: pageContext, request, session, and application

B. Value Options: <% = session. getAttribute ("usename"); % >/$ {sessionScope. username}

3.2 hidden objects related to input: param and paramValues

Value Options: <% = request. getParamter ("username"); % >/$ {param. name}/$ {paramValues. username}

3.3. Other implied objects

A. cookie: $ {cookie. username}

B. header and headerValues: data used for communication between the user's browser and the server

C. initParam: Obtain the environment parameter (Context) of the website)

String userid = (String) application. getInitParameter ("userid");/$ {initParam. userid}

D. pageContext: obtain detailed information about user requirements or pages.

$ {PageContext. request. queryString} gets the request parameter string
$ {PageContext. request. requestURL} retrieves the request URL, excluding the request parameter string
$ {PageContext. request. contextPath} indicates the name of the web application of the service.
$ {PageContext. request. method} GET the HTTP method (GET, POST)
$ {PageContext. request. protocol} gets the used protocol (HTTP/1.1, HTTP/1.0)
$ {PageContext. request. remoteUser} obtains the user name
$ {PageContext. request. remoteAddr} gets the user's IP address
$ {PageContext. session. new} checks whether the session is new.
$ {PageContext. session. id} obtains the session ID.
$ {PageContext. servletContext. serverInfo} obtains the service information of the host.

4. JSP built-in object type ing table:

Object Name type Scope

Request javax. servlet. ServletRequest RequestScope

Response javax. servlet. ServletResponse pagination

PageContext javax. servlet. jsp. PageContext pagination

Session javax. servlet. http. HttpSession SessionScope

Application javax. servlet. ServletContext ApplicationScope

Out javax. servlet. jsp. JspWriter pagination

Config javax. servlet. ServletConfig pagination

Page java. lang. Object pagination

Exception javax. lang. Throwable pagination

5. pageContext

This object is special. It can be seen from its type that it is unique to jsp. servlet does not have this object. The pageContext object provides access to all objects and namespaces on the JSP page,

That is to say, he can access the session where this page is located, or take a property value of the application where this page is located, which is equivalent to all functions of the page.


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.