Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 07-08-2009
Member
 
Join Date: Aug 2009
Posts: 4
What are the implicit objects in JSP?

Hi,

What are the implicit objects in JSP?

Thanks,
Coffee
Reply With Quote
  #2  
Old 07-08-2009
Member
 
Join Date: May 2008
Posts: 32
Re: What are the implicit objects in JSP?

JSP Implicit Objects

Implicit objects in jsp are the objects that are created by the container automatically and the container makes them available to the developers, the developer do not need to create them explicitly. Since these objects are created automatically by the container and are accessed using standard variables; hence, they are called implicit objects. The implicit objects are parsed by the container and inserted into the generated servlet code. They are available only within the jspService method and not in any declaration. Implicit objects are used for different purposes. Our own methods (user defined methods) can't access them as they are local to the service method and are created at the conversion time of a jsp into a servlet. But we can pass them to our own method if we wish to use them locally in those functions.

There are nine implicit objects.

Object ------ Class

application javax.servlet.ServletContext
config javax.servlet.ServletConfig
exception java.lang.Throwable
out javax.servlet.jsp.JspWriter
page java.lang.Object
PageContext javax.servlet.jsp.PageContext
request javax.servlet.ServletRequest
response javax.servlet.ServletResponse
session javax.servlet.http.HttpSession

I hope this tutorial helps you learn JSP implicit objects.
Reply With Quote
  #3  
Old 07-08-2009
Member
 
Join Date: May 2008
Posts: 21
Re: What are the implicit objects in JSP?

Implicit Objects:

Implicit Objects in JSP are objects that are automatically available in JSP. Implicit Objects are Java objects that the JSP Container provides to a developer to access them in their program using JavaBeans and Servlets. These objects are called implicit objects because they are automatically instantiated.

Some of them are:

request:
The class or the interface name of the object request is http.httpservletrequest. The object request is of type Javax.servlet.http.httpservletrequest. This denotes the data included with the HTTP Request. The client first makes a request that is then passed to the server. The requested object is used to take the value from client?s web browser and pass it to the server. This is performed using HTTP request like headers, cookies and arguments.

response:
This denotes the HTTP Response data. The result or the information from a request is denoted by this object. This is in contrast to the request object. The class or the interface name of the object response is http.HttpServletResponse. The object response is of type Javax.servlet.http. >httpservletresponse. Generally, the object response is used with cookies. The response object is also used with HTTP Headers.

Session:
This denotes the data associated with a specific session of user. The class or the interface name of the object Session is http.HttpSession. The object Session is of type Javax.servlet.http.httpsession. The previous two objects, request and response, are used to pass information from web browser to server and from server to web browser respectively. The Session Object provides the connection or association between the client and the server. The main use of Session Objects is for maintaining states when there are multiple page requests. This will be explained in further detail in following sections.
Reply With Quote
  #4  
Old 07-08-2009
Member
 
Join Date: May 2008
Posts: 41
Re: What are the implicit objects in JSP?

JSP Implicit Objects

Implicit objects in JSP are the Java objects that the JSP Container makes available to developers in each page. These objects need not be declared or instantiated by the JSP author. They are automatically instantiated by the container and are accessed using standard variables; hence, they are called implicit objects. The implicit objects are parsed by the container and inserted into the generated servlet code. They are available only within the jspService method and not in any declaration.

The implicit objects available in JSP are as follows:

The application object

The application object has an application scope. It is an instance of the javax.servlet.ServletContext class. It represents the context within which the JSP is executing. It defines a set of methods that a servlet uses to communicate with its servlet container. These functions include getting the MIME type, request dispatching, and writing contents to a log file. It allows the Web components in the JSP page in the application to share information.

The config object

The config object has a page scope. It is an instance of the javax.servlet.ServletConfig class. The ServletConfig parameter can be set up in the web.xml inside the <jsp-file> element. It uses the getInitParameter(String param) to obtain initialization parameters and the getServletContext() method to obtain the ServletContext object.

The exception object

The exception object has a page scope. It is an instance of the java.lang.Throwable class. It refers to the runtime exception that resulted in the error-page being invoked. This is available only in an error page, i.e., a page that has isErrorPage=true in the page directive.

The PageContext object

The PageContext object has a page scope. It is an instance of the javax.servlet.jsp.PageContext class. It encapsulates the page-context for the particular JSP page. A PageContext instance provides access to all the namespaces associated with a JSP page. It also provides access to several page attributes such as to include some static or dynamic resource. Implicit objects are added to the PageContext automatically.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "What are the implicit objects in JSP?"
Thread Thread Starter Forum Replies Last Post
Difference between Implicit & Explicit type conversions Sarfaraj Khan Software Development 5 09-02-2010 02:47 PM
Meaning of Explicit and Implicit Conversion Sheenas Software Development 5 30-01-2010 12:42 PM
Visual Basic 2008 error "Option Strict On disallows implicit conversions" Caiden Software Development 3 30-10-2009 06:27 PM
Bypass implicit operator conversion Sujit15 Software Development 3 14-05-2009 11:02 AM
Difference between Implicit and Explicit Declaration vinodpathak_214 Software Development 3 16-01-2009 10:00 AM


All times are GMT +5.5. The time now is 07:50 PM.