JBuilder2005 combat the JSP error handling

  Error handling pages error.JSP 

  Web applications normally have one or more error handling reunification of the JSP pages to JSP pages function of a mistake, we can in a friendly in the form of user feedback.    Friendly and reunification of the error page is a Web display layer inevitably neglected aspects. 

  Below, we have created error handling error.jsp document, and its code as follows: 

  11 list of code error handling JSP pages error.jsp 

  1. <% @ Page contentType = "text / html; charset = GBK" isErrorPage = "true"%> 
  2. <html> 
  3. <head> 
  4. <title> Error </ title> 
  5. </ Head> 
  6. <body Bgcolor="#ffffff"> 
  7. Sorry, the system abnormalities, click on <a href = "login.jsp"> here </ a> Return to Home 
  8. </ Body> 
  9. </ Html> 
  Error handling JSP pages in the page directive labels isErrorPage attribute set to be true, as shown in the first line, this JSP pages can be an implied exception to the object.    In the first seven lines, we have a kind of "elegant" approach to user error reporting procedures and to provide a return to the login page for the link. 

  Now, we come back to, through <% @ page errorPage = "error handling JSP"%> will be designated as switch.jsp error.jsp error handling and login.jsp page. 

  To add error handling switch.jsp page after page, the code below: 

  Switch.jsp code lists 12 pages add error handling Jsp 

  1. <% @ Page contentType = "text / html; charset = GBK" errorPage = "error.jsp"%> 
  2. <% @ Page import = "bookstore .*"%> 
  3. <% @ Page import = "Java. Sql .*"%> 
  4.… 
  Login.jsp page to add error handling JSP pages, its code is as follows: 

  Code lists 13 pages login.jsp add error handling 

  1. <% @ Page contentType = "text / html; charset = GBK" errorPage = "error.jsp"%> 
  2. <% @ Page errorPage = "error_error.jsp"%> 
  3.… 
  In this way, when the SQL query switch.jsp incorrect SQLException trigger abnormal, that obscure trace of arcane information abnormal error pages disappeared, replaced by a friendly Below is the error page: 


  Figure 15 friendly error handling pages Za failure fail.JSP 

  When users do not provide the correct password, fail.jsp switch.jsp will turn to the pages, you can also create JSP Wizard fail.jsp pages, fail.jsp code as follows: 

  Code lists 14 pages failure fail.jsp Login 

  1. <% @ Page contentType = "text / html; charset = GBK" errorPage = "error.jsp"%> 
  2. <html> 
  3. <head> 
  4. <title> 
  5. Fail 
  6. </ Title> 
  7. </ Head> 
  8. <body Bgcolor="#ffffff"> 
  9. You enter the password is not correct, click on <a href = "login.jsp"> here </ a> to return to login page. 
  10. </ Body> 
  11. </ Html> 
  When a user password entry errors, see pages fail.jsp results, as shown below: 


  Figure 16 pages effect fail.jsp 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Recommend Articles

Comments

Leave a Reply