MY mENU


Thursday, 22 March 2012

How does JSP handle run-time exceptions?

You can use the errorPage attribute of the page directive to have uncaught run-time exceptions automatically forwarded to an error processing page.

For example: 

<%@ page errorPage="error.jsp" %> 

redirects the browser to the JSP page error.jsp if an uncaught exception is encountered during request processing. Within error.jsp, if you indicate that it is an error-processing page, via the directive:

<%@ page isErrorPage="true" %>

In the error pages we can access exception implicit object.

How is scripting disabled in Jsp

Scripting is disabled by setting the scripting-invalid element of the deployment descriptor to true. It is a subelement of jsp-property-group. Its valid values are true and false. The syntax for disabling scripting is as follows


The JSP implicit objects


Implicit objects are by default available to the JSP. Being JSP author we can use these and not required to create it explicitly.
  1. request
  2. response
  3. pageContext
  4. session
  5. application
  6. out
  7. config
  8. page
  9. exception