There are many built-in objects in an expression language.
PageContext, Pagescope,requestscope,sessionscope,applicationscope,param,paramvalues,header,headervalues,cookie, Initparam
<%@ page contenttype= "text/html" pageencoding= "GBK"%> Pagecontext.setattribute ( "Info", "page attribute range"); Request.setattribute ("info", "Request attribute range"); Session.setattribute ("Info", "Session attribute range"); Application.setattribute ("info", "Application attribute range"); %>In the different attribute ranges described above, the El's lookup range is page->request->session->application if the same name property is saved.
At this point, in order to accurately locate, you can rely on the built-in object help: Pagescope,requestscope,sessionscope,applicationscope
The above code can be changed to:
<%@ page contenttype= "text/html" pageencoding= "GBK"%> Pagecontext.setattribute ( "Info", "page attribute range"); Request.setattribute ("info", "Request attribute range"); Session.setattribute ("Info", "Session attribute range"); Application.setattribute ("info", "Application attribute range"); %>Through the El's built-in objects can also be found PageContext, before the time to explain the built-in objects, PageContext can get request,session,application and other objects, now you can directly through the El built-in object method call:
<%@ page contenttype= "text/html" pageencoding= "GBK"%> New}
The above naming and operation is to rely on the reflection mechanism to complete, is,get are automatically converted.
You can also receive parameters, pass parameters through URL rewriting, and if you want to receive parameters, complete the param parameter.
<%@ page contenttype= "text/html" pageencoding= "GBK"%>
When no arguments are passed, the first line shows NULL, and the second line shows a blank.
The first way to receive a parameter: URL rewrite: Http://localhost:8080/wly/eldemo/get_param_demo.jsp?ref=lixinghua
Pass parameters:
<HTML><HEAD><TITLE>WWW.MLDNJAVA.CN,MLDN High-end Java training </title> Interests: <input type= "checkbox" Name= "Inst" Value= "singing" > singing <input type= "checkbox" Name= "Inst" value= "swimming" > swimming <input type= " CheckBox "Name=" Inst "value=" reading "> reading <input type=" Submit "value=" Show "></form></body >
Receive param_values_demo.jsp, need to use Paramvalues to receive a set of parameters, because now received is an array, you need subscript access:
<%@ page contenttype= "text/html" pageencoding= "GBK"%>// Serious development, this code is implemented through the filter request.setcharacterencoding ("GBK"); %>In the actual development, the most used or Param object, receive a parameter. From the MVC pattern, all parameter reception should be cross-servlet.
Summarize:
1. El takes sequential mode output properties: Page<request<session<application, but avoids the existence of the same name attribute in general development
2. Receive $ (attribute) for parameters via param
Expression language-built-in objects