Handling Unhandled Exceptions
| Published on 5/22/2008 by Dotnetindex More articles in JSP
|
Java Server Pages (JSP) could handle any erros that might be arised in scriptlets, expressions, or other JSP elements. You could use try/cacth blocks to handle any known erros. In this technic we could use to display a custom error on our file where unhandled exception is thrown. Add this line on your first line of your page : Step 2. Let's add some Java codes which are containing some errors : <% private int intCounter; intCounter = "Hello Word!" %> Step 3. In previous step we make a stupid coding error. But when client browse to page, JSP server will redirect page to our error page. Here is our error page codes : 1. <%@ page isErrorPage="true" %>
First line (Line 1), describes that this page is an error page and must track last error on Java codes. 3. line is ouw message. Line 5 displays error coming from our Java Server Page. If you wish your client does not know the error message just delete it.
Happy Coding ! |
no comments submitted



