Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Jsp Simple-jsp-example Generate Error in JSP

Related Tutorials


 
 

Share on Google+Share on Google+

Generate Error in JSP

Advertisement
In software engineering, the term refers to an incorrect action or calculation performed by software.

Generate Error in JSP

        

In software engineering, the term refers to an incorrect action or calculation performed by software. In general we can say that the error results from a combination of a defect and a fault. If, as a result of the error, the system performs an undesired actions or fails to perform a desired action, then this is referred as a failure. 

An error may be detected by the software which can be handled by raising an exception. eg. 404 or Not found error message is an Http standard response code indicating that the server either could not find what was requested. These errors messages are generated by the browsers. In HTTP error 500, the web server encountered an unexpected condition that prevented it from fulfilling the request by the client. There are many more Http errors codes available. They are not discussed in this example.

The code of the program is given below:

 

<HTML>
  <HEAD><TITLE>Generate Error in jsp</TITLE></HEAD>
  <BODY>
    This page generates an error when you click the button.<P>
    <FORM METHOD="POST" ACTION="ErrorPagr.jsp">
      <INPUT TYPE="HIDDEN" NAME="errorValue" VALUE="error">
      <INPUT TYPE="SUBMIT" VALUE="Generate exception!">
    </FORM>
  </BODY>
</HTML>

 

<%
  String hiddenvalue = request.getParameter("errorValue");
  if ( hiddenvalue.equals("error"))
    throw new java.lang.NullPointerException();
%>

Output of the Program:

 

Download this example.

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 11, 2008

Related Tutorials

Discuss: Generate Error in JSP  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com