Figure 4-1: Internet Explorer asks you what to do with this MIME type. Were you to open the file from its present location, Internet Explorer would display the file as a Word document. Were you to save the file, Windows would save the file as a Word document. Netscape would behave in a similar fashion. You can set a character set for encoding as the following example illustrates: <%@ page contentType="TYPE=text/plain;CHARSET=ISO-8859-1" %> Set the type to plain text using the character set ISO-8859-1. The errorPage Attribute The errorPage attribute defines another JSP page as one that handles unchecked runtime exceptions. The value of the errorPage attribute is a relative URL. Note Relative URLs, when coded with /as the first character (called a context-relative path), are referenced from the application; when coded without / as the first character, they are referenced from the JSP page. You cannot code an absolute URL reference in JSP pages. For example, the following directive displays MyErrorPage.jsp when all uncaught exceptions are thrown: <%@ page errorPage="MyErrorPage.jsp" %> MyErrorPage.jsp is stored in the same directory as the page containing the above page directive. If you code the directive as follows: <%@ page errorPage="/MyErrorPage.jsp" %> then MyErrorPage is stored in the root directory of the application. You can use the setAttribute() method of class javax.servlet.jsp.ServletException to pass the exception object
We feature a web hosting shopping cart and live support solution. Just try our web hosting shopping cartwhich provides a secure way of obtaining payments through your website.

Leave a Reply