An implicit variable is referenced in an EL expression

Source: Internet
Author: User

In addition to the 9 large implicit variables in the JSP (also called pre-defined variables in the previous article), you can see in the _jspservice after conversion into a servlet:

public void _jspservice (final javax.servlet.http.HttpServletRequest request, final Javax.servlet.http.HttpServletResponse response)
Throws Java.io.IOException, Javax.servlet.ServletException {

Final Javax.servlet.jsp.PageContext PageContext;
Javax.servlet.http.HttpSession session = NULL;
Final Javax.servlet.ServletContext Application;
Final Javax.servlet.ServletConfig config;
Javax.servlet.jsp.JspWriter out = null;
Final Java.lang.Object page = this;
Javax.servlet.jsp.JspWriter _jspx_out = null;
Javax.servlet.jsp.PageContext _jspx_page_context = null;

To improve efficiency, the following implicit objects are regulated in the El Expression:

(1) PageContext
The PageContext object references the current PageContext. PageContext. Class has the request, Response,session,out, and ServletContext properties (that is, getrequest,getresponse,getsession, Getout, Getservletcontext method). For example, the following expression outputs the current session ID

${pagecontext.session.id}

(2) Param and paramvalue
These objects allow us to access a basic request parameter bit (param) or an array of request parameter values (paramvalues). Therefore, the following expression outputs the value of the CustID request parameter (returns an empty string if the parameter does not exist in the current request). ${param.custid}

(3) Header and Headervalues
These objects access the main value of the HTTP request header and all values, respectively. In retrospect, you cannot use dot notation if the value after the dot number cannot be a valid name. Therefore, to access the accept header, we can use ${header. Accept}, or ${header["accept"}

Similar objects also have cookies, Initparam,pagescope,requestscope,sessionscope,applicationscope

An implicit variable is referenced in an EL expression

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.