Hi,
in my jsp page when sql exception occurs, i forward to the page error.jsp to display the message. but it not working . here is an page
Code:
<%-- 
    Document   : groupaddok
    Created on : Aug 4, 2008, 4:20:31 PM
    Author     : user1
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page language ="java" %>
<%@ page errorPage="errorpage.jsp" %>
<%@ page import="java.sql.*, javax.sql.*, javax.naming.*,java.io.*,java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>add user</title>
        <link rel="stylesheet" href="styles/styles.css" type="text/css"> 
    </head>
    <body>
         <table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><%@ include file="/includes/logohead.jsp" %></td>
</tr> 
<tr><td><%@ include file="/toplinks.jsp"%></td></tr>
<tr><td width="100%" valign="top">
<table width="100%" cellspacing="0" cellpadding="0" border="1" borderColor=#000066>
    <tr>
<td width="80%">&nbsp;&nbsp;&nbsp;
    
    <table border="1" width="50%" cellpadding="0" cellspacing="0" align="center" bordercolor="#B0C4DE">
       <% 
    String DESCRIPTION = request.getParameter("desc");   
            
     String connectionURL = "jdbc:mysql://localhost:3306/mynewdatabase";
   
     Connection connection = null;   
     PreparedStatement pstatement = null;
   
     Class.forName("com.mysql.jdbc.Driver").newInstance();
     int updateQuery = 0;
     
	
	 if(DESCRIPTION!=null){		
	     if(DESCRIPTION!="") {
            try {            
              
              connection = DriverManager.getConnection
              (connectionURL, "root", "root123");
             
              String queryString = "INSERT INTO groupid(description) VALUES (?)";
	      pstatement = connection.prepareStatement(queryString);
               pstatement.setString(1,DESCRIPTION );
              
              updateQuery = pstatement.executeUpdate();
              //out.println("Q.="+updateQuery);
              if (updateQuery != 0) { %>
	          
		   
              <%
             
            }
              }
            
            catch (Exception ex) {
           // out.println("a"+ex.getMessage());    
           // out.println("Unable to connect to batabase.");
   
            }
            finally {
                pstatement.close();
                connection.close();
            }
	  }
	}
       %>
   <tr><td width="60%" class="StripFinalbold" ><font class="Fontfinalbold">The Group <%=DESCRIPTION%>  are added into Database.</font></td></tr></table>
</td></tr></table></td></tr>
   </table>
    </body>
</html>
and here is an error.jsp page

Code:
<%-- 
    Document   : errorpage
    Created on : Aug 5, 2008, 4:34:03 PM
    Author     : user1
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page isErrorPage="true" import="java.io.*,java.sql.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
<%-- Exception Handler --%>
<font color="red">
    <P> THE ENTRY<%= exception.toString()%> ARE DUPLICATE IN  DATABASE</p><br>
</font>
<%
out.println("<!--");
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
exception.printStackTrace(pw);
out.print(sw);
sw.close();
pw.close();
out.println("-->");
%>

<p> here is an test </p>

    </body>
</html>
Any suggestion is highly appreciated
Thanks and Regards
haresh