MY mENU


Saturday 7 April 2012

JSP Implicit Objects


JSP container provides a list of instantiated objects for you to access different kind of data in a web application. Those objects are called implicit object because it is automatically available to access. These are some main implicit objects in JSP which you use most:

  • request object
  • response object
  • session object
  • out object
  • pageContext object
  • application object
  • config object
  • page object
  • excpetion object

The request object

Each time a client requests a JSP page, the JSP engine creates a new object to represents that request called request object.  The request object is an instance of classjavax.servlet.http.HttpServletRequest. The request object contains all information about the current HTTP request and the clients.  Be noted that request object only available in a scope of the current request. It is re-created each time new request is made.
By using methods of the request object you can access almost information such as HTTP header, query string, cookies...

The response object

JSP also creates the response object which is an instance of classjavax.servlet.http.HttpServletResponse.  The response object represents the response to the client. By using this object you can add new cookies, change MIME content type of the page. In addition, the response object also contains sufficient information on the HTTP to be able to return HTTP status codes or make the page redirect to the other page.

The session object

The session object is used to track information of a particular client between multiple requests. the session object is avaible in the server so it can helps you to overcome the stateless of HTTP protocol. You can use session object to store a arbitrary information between client requests. The session object is an instance of classjavax.servlet.http.HttpSession.

The out object

The output stream is exposed to the JSP through the out object. the out object is an instance of class javax.servlet.jsp.JspWriter. The out object may refer to an output stream or a filtered stream... You can use the out object methods to send the data into the output stream such as println method. Then JSP take care the rest.

The pageContext object

The pageContext object represent the entire JSP page. You can use the pageContext objectto get page attributes of a page. the pageContext object is an instance of classjavax.servlet.jsp.pagecontext.

The application object

The application object is a representation of JSP page through its life cycle. The application object is created when a JSP page is initialized and removed when the JSP page is removed by jspDestroy() method or JSP page is recompiled. As its name imply, the information of the application object is accessible to any object used within the JSP page.

The config object

The config object allows you to access the initialization parameters for the Servlet and JSP engine. The config object is an instance of the class javax.servlet.ServletConfig.

The page object

The page object is an instance of a JSP page. By using the page object, you can call any method of the page's servlet.

The exception object

The exception object contains the exception which is thrown from the previous JSP page. You can use the exception object to generate friendly error message based on erorr condition to the end-user.

Find Every File


When you search for a file in Windows Windows searches only for file types it recognizes. Files that aren't listed in the 'Registered file types' list are ignored. Fortunately, a simple edit of the Registry will make Windows search for every file, regardless of its extension. Open the Registry Editor as described above, and then navigate to and select:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex.

 Double-click the FilterFilesWithUnknownExtensions icon in the right pane, change the 0 in the 'Value data' box to 1, and press Enter. To ensure that Windows XP searches for every possible file, select All Files and Folders under 'Type of file' in the Search Companion pane. (If you don't see this option, click More Advanced Options.) Check Search system folders, Search hidden
files and folders, and Search subfolders (as desired). In Windows 2000, click Search Options, check Type, and make sure that (All Files and Folders) is selected in the resulting drop-down menu. Check Advanced Options, and make sure Search Subfolders is checked. Finally, to ensure that Windows 2000 finds system and hidden files, choose Tools, Folder Options and click the View tab. In the 'Advanced settings' list, select Show hidden files and folders. Uncheck Hide protected operating system files (Recommended), click Yes to acknowledge the warning, and finish by clicking OK.