- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34484 Articles for Programming
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
498 Views
The errorPage attribute tells the JSP engine which page to display if there is an error while the current page runs. The value of the errorPage attribute is a relative URL.The following directive displays MyErrorPage.jsp when all uncaught exceptions are thrown −The isErrorPage attribute indicates that the current JSP can be used as the error page for another JSP.The value of isErrorPage is either true or false. The default value of the isErrorPage attribute is false.For example, handleError.jsp sets the isErrorPage option to true because it is supposed to handle errors −
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
2K+ Views
Following is the example which uses getHeaderNames() method of HttpServletRequest to read the HTTP header information. This method returns an Enumeration that contains the header information associated with the current HTTP request.Once we have an Enumeration, we can loop down the Enumeration in the standard manner. We will use the hasMoreElements() method to determine when to stop and the nextElement() method to get the name of each parameter name. HTTP Header Request Example HTTP Header Request Example ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
4K+ Views
The contentType attribute sets the character encoding for the JSP page and for the generated response page. The default content type is text/html, which is the standard content type for HTML pages.If you want to write out XML from your JSP, use the following page directive −The following statement directs the browser to render the generated page as HTML −The following directive sets the content type as a Microsoft Word document −You can also specify the character encoding for the response. For example, if you wanted to specify that the resulting page that is returned to the browser uses ISO ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
1K+ Views
The autoFlush attribute specifies whether the buffered output should be flushed automatically when the buffer is filled, or whether an exception should be raised to indicate the buffer overflow.A value of true (default) indicates automatic buffer flushing and a value of false throws an exception.The following directive causes the servlet to throw an exception when the servlet's output buffer is full −This directive causes the servlet to flush the output buffer when full −Usually, the buffer and the autoFlush attributes are coded on a single page directive as follows −
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
147 Views
The buffer attribute specifies the buffering characteristics for the server output response object.You may code value of "none" to specify no buffering so that the servlet output is immediately directed to the response object or you may code a maximum buffer size in kilobytes, which directs the servlet to write to the buffer before writing to the response object.To direct the servlet to write the output directly to the response output object, use the following −
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
213 Views
If you want to handle errors within the same page and want to take some action instead of firing an error page, you can make use of the try....catch block.Following is a simple example which shows how to use the try...catch block. Let us put the following code in main.jsp − Try...Catch Example Access the main.jsp, it should generate an output somewhat like the following −An exception occurred: / by zero
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
750 Views
The buffer attribute specifies the buffering characteristics for the server output response object.You may code a value of "none" to specify no buffering so that the servlet output is immediately directed to the response object or you may code a maximum buffer size in kilobytes, which directs the servlet to write to the buffer before writing to the response object.To direct the servlet to write the output directly to the response output object, use the following −Use the following to direct the servlet to write the output to a buffer of size not less than 8 kilobytes −
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
487 Views
Following table lists out the attributes associated with the page directive −S.No.Attribute & Purpose1bufferSpecifies a buffering model for the output stream.2autoFlushControls the behavior of the servlet output buffer.3contentTypeDefines the character encoding scheme.4errorPageDefines the URL of another JSP that reports on Java unchecked runtime exceptions.5isErrorPageIndicates if this JSP page is a URL specified by another JSP page's errorPage attribute.6extendsSpecifies a superclass that the generated servlet must extend.7importSpecifies a list of packages or classes for use in the JSP as the Java import statement does for Java classes.8infoDefines a string that can be accessed with the servlet's getServletInfo() method.9isThreadSafeDefines the threading model ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
171 Views
The page directive is used to provide instructions to the container. These instructions pertain to the current JSP page. You may code page directives anywhere in your JSP page. By convention, page directives are coded at the top of the JSP page.Following is the basic syntax of the page directive −You can write the XML equivalent of the above syntax as follows −AttributesFollowing table lists out the attributes associated with the page directive −S.No.Attribute & Purpose1bufferSpecifies a buffering model for the output stream.2autoFlushControls the behavior of the servlet output buffer.3contentTypeDefines the character encoding scheme.4errorPageDefines the URL of another JSP that ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
469 Views
You can make use of JSTL tags to write an error page ShowError.jsp with better structure and more information − Show Error Page Opps... Error: ${pageContext.exception} URI: ${pageContext.errorData.requestURI} ... Read More