You are here: Articles > Computers & Technology > jsp

 See more articles about "jsp "

JSP and JSTL Tutorials - Tutorial Addendum - Beheading Ambience



 31 December 18:00   

    



    



    



    

Predefined Objects

    



    

Now we understand that the Java statements anchored in JSP pages will translated into

    

_jspService() adjustment of a appropriate Servlet class. In that method, there are

    

a brace of pre-defined altar accessible for the anchored Java statements:

    



        

  • out: The achievement beck to aggregate activating data to be alloyed into the final Web

        

    document.

        



  •     

  • this: The instance of the appropriate Servlet class.

        



  •     

  • request: An HttpServletRequest item apery the appeal accustomed from

        

    the Web browser.

        



  •     

  • response: An HttpServletResponse item apery the acknowledgment to be delivered

        

    back to the Web browser.

        



  •     

  • session: An HttpSession item apery the abstraction of bond assorted trips

        

    of requests and acknowledgment into a individual action unit.

        



  •     

  • application: A ServletContext item apery the abstraction of alignment Servlets

        

    into a individual application.

        



  •     

  • config: A ServletConfig object.

        



  •     

  • pageContext: A PageContext object.

        



  •     



    



    

The afterward JSP page will appearance you added data about those pre-defined objects:

    

 

    

<!--

    

- ContextInfo.jsp

    

- Absorb (c) 2002 by Dr. Yang. All rights reserved.

    

-->

    

<html><body>

    

<p>

    

<b>JSP Page Ambience Information</b><br/>

    

</p>

    

<p>

    

<b>Pre-defined objects:</b><br/>

    

<%

    

out.println("out: "+out.getClass().getName()+"<br/>");

    

out.println("this: "+this.getClass().getName()+"<br/>");

    

out.println("request: "+request.getClass().getName()+"<br/>");

    

out.println("response: "+response.getClass().getName()+"<br/>");

    

out.println("session: "+session.getClass().getName()+"<br/>");

    

out.println("application: "+application.getClass().getName()

    

+"<br/>");

    

out.println("config: "+config.getClass().getName()+"<br/>");

    

out.println("pageContext: "+pageContext.getClass().getName()

    

+"<br/>");

    

%>

    

</p>

    

<p>

    

<b>Information about session:</b><br/>

    

<i>= pageContext.getSession();</i><br/>

    

<%

    

out.println("Class Name: "+session.getClass().getName()+"<br/>");

    

out.println("Session ID: "+session.getId()+"<br/>");

    

java.util.Date d = new java.util.Date();

    

d.setTime(session.getCreationTime());

    

out.println("Create Time: "+d.toString()+"<br/>");

    

d.setTime(session.getLastAccessedTime());

    

out.println("Last Admission Time: "+d.toString()+"<br/>");

    

out.println("Is Affair New: "+session.isNew()+"<br/>");

    

%>

    

</p>

    

<p>

    

<b>Information about sessionContext:</b><br/>

    

<i>= session.getSessionContext();</i><br/>

    

<%

    

javax.servlet.http.HttpSessionContext c

    

= session.getSessionContext();

    

out.println("Class name: "+c.getClass().getName()+"<br/>");

    

%>

    

</p>

    

<p>

    

<b>Information about application:</b><br/>

    

<i>= pageContext.getServletContext();</i><br/>

    

<%

    

out.println("Class Name: "+application.getClass().getName()+"<br/>");

    

out.println("Major Version: "+application.getMajorVersion()+"<br/>");

    

out.println("Minor Version: "+application.getMinorVersion()+"<br/>");

    

out.println("Server Info: "+application.getServerInfo()+"<br/>");

    

out.println("Serlet Ambience Name: "

    

+application.getServletContextName()+"<br/>");

    

java.util.Enumeration e = application.getServletNames();

    

while (e.hasMoreElements()) {

    

Cord n = (String) e.nextElement();

    

out.println("Servlet Name: "+n+"<br/>");

    

}

    

e = application.getInitParameterNames();

    

while (e.hasMoreElements()) {

    

Cord n = (String) e.nextElement();

    

out.println("Init Constant Name: "+n+"<br/>");

    

}

    

%>

    

</p>

    

</body></html>

    



    

(Continued on next part...)

    



    



    



 


 println, session, application, getclass, getname, object, pagecontext, response, class, context, servlet, string, request, representing, information, objects, config, defined, , getname <, getclass getname, object representing, representing the, class name, java util, println class, defined objects, pre defined, information about, pre defined objects, println class name, session getclass getname, application getclass getname, java util date, special servlet class, tutorials tutorial notes, tutorial notes execution, notes execution context, jstl tutorials tutorial,

Share JSP and JSTL Tutorials - Tutorial Addendum - Beheading Ambience:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

JSP and JSTL Tutorials - Tutorial Addendum - Beheading Ambience
i(Continued from antecedent part...)/iOutput: JSP Page Ambience InformationPre defined objects:out: org.apache.jasper.runtime.JspWriterImplthis: org.apache.jsp.Conte

JSP and JSTL Tutorials - Tutorial Addendum - Using Accolade
i(Continued from antecedent part...)/iHere is simple JSP page that set accolade in altered ways, CookieDump.jsp: <?xml version="1.0"?<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" ve

JSP and JSTL Tutorials - Tutorial Addendum - JSP Elements
Syntactic Elements of a JSP PageThere are two types of data in a JSP page:Template Data: The changeless part, annihilation that will be affected anon to the ac

JSP and JSTL Tutorials - Tutorial Addendum - JSP Elements
i(Continued from antecedent part...)/iWhat happens actuality is that the server is apparently sending acknowledgment withcontent type set to text/xml. To fix the problem, we charge to use a directiveelemen

JSP and JSTL Tutorials - Tutorial Addendum - JSP Elements
i(Continued from antecedent part...)/iJSP Archetype "CurrentTime.jsp"The afterward archetype has three JSP files alive calm to appearance you how to use "deca

JSP and JSTL Tutorials - Tutorial Addendum - JSP Elements
i(Continued from antecedent part...)/iIt s actual absorbing to see the Servlet chic translated from CurrentTime.jsp: package org.apache.jsp;import javax.servlet.*;import javax.ser

JSP and JSTL Tutorials - Tutorial Addendum - Book Upload
This affiliate shows you:What are the requirements to upload files to Web servers.The RFC 1867 addendum of HTML for uploading files.How to address a HTML page

JSP and JSTL Tutorials - Tutorial Addendum - Book Upload
i(Continued from antecedent part...)/iHere is sample HTML page to appearance you how to use Book ascribe acreage and "multipart/form data" encryption type: <?xml version="1.0"?p

JSP and JSTL Tutorials - Tutorial Addendum - Book Upload
i(Continued from antecedent part...)/iOf course, I aswell wrote the UploadForm.jsp to present the book upload anatomy page basedthe settings: <?xml version="1.0"?<jsp:root

JSP and JSTL Tutorials - Tutorial Addendum - Book Upload
i(Continued from antecedent part...)/iUploadSave.jsp Extenuative Uploaded FilesAs you can see from the antecedent section, auctioning uploaded files aback to the br