JSP Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
JSP Tutorial
Introduction Introduction
Installing JDK-Windows Installing JDK-Windows
Installing JDK-Linux Installing JDK-Linux
Installing Tomcat Installing Tomcat
Simple Program in JSP Simple Program in JSP
Pre-defined Variables Pre-defined Variables
Syntax of Tags Syntax of Tags
JSP Expression Language JSP Expression Language
JSP EL Operators JSP EL Operators
EL Implicit Variables EL Implicit Variables
Scopes Scopes
Using Arrays Using Arrays
Methods Methods
JSP Elements JSP Elements
Including Beans Including Beans
JSTL Tags JSTL Tags
Custom Tags Custom Tags
Session Session in JSP
Handling Cookies Handling Cookies
JSP Application Structure JSP Application Structure
Configuring web.xml Configuring web.xml
Tomcat Configuration Tomcat Configuration
JSP Examples JSP Examples
Forums Ask Your Doubts
Feedback Feedback
 






outsourced web hosting support

Expression Language Implicit Variables in JSP.


Tutorials Jsp

Topic

How are Implicit Variables used in JSP?



Explanation

Implicit variables are those which are instantiated automatically and are references to objects created by the JSP EL language. These are provided by default by the JSP container.

Following are the list of implicit objects provided by JSP.

Variables Description
pageScope Collection of all page scope variables
requestScope Collection of all request scope variables
sessionScope Collection of all session scope variables
applicationScope Collection of all application scope variables
param Collection of all request parameter as single string value per parameter
paramValue Collection of all request parameter as string array per parameter
header Collection of all request header values as a single string value per header
headerValues Collection of all request header values as string array per header.
cookie Collection of all request cookie values as javax.servlet.http.Cookie value per cookie
intiParam Collection of all application intialization parameter as single string value per value
pageContext Instance of javax.servlet.jsp.Pagecontext class to access various request data.


Example:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions"
    prefix="fn" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core"
    prefix="c" %>
    <html>
    <body>
    <form action="implicit1.jsp" method="GET">
    NAME:<input type="text" name="nam">
         <input type="submit">
    </form>
    <p><b>NAME</b>     : ${param.nam}</p>
    <p><b>HEADER</b>   : ${header["host"]}</p>
    <p><b>USER AGENT</b>:${header["user-agent"]}</p>
    </html>
Result:
    NAME : alex
    HEADER : localhost:8080
    USER AGENT:Mozilla/5.0 (Windows; U; Windows NT 5.1; 
    en-US; rv:1.9.0.15)Gecko/2009101601 Firefox/3.0.15 
    GTB5

In the above example we have used the implicit variables "param" and "header" to display the name entered, header, browser details etc.




A Note
JSP(Java Server Pages) is one of the most used Server Side Programming Language in the world. Simple introduction, basic program codes with examples. Begin coding your own JSP scripts with this online tutorial. Hope you enjoy this tutorial. Do send your feedback or suggestions on this JavaServer Pages tutorial. This is a copyright content.


Other Links

web hosting