hi..

when iam inserting data using jsp..its coming error of like that..the data is inserted in database..but displays error...why???

why???

my insertion code is as follow:

<%@ page import =" java.sql.Date.*" %>
<%@ page import =" java.text.SimpleDateFormat.*" %>
<%@ page import =" java.text.DateFormat.*" %>
<%@ page import =" java.util.Date.*" %>
<%@ page import="java.text.*" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page language="java" import="java.sql.*" %>
<%@ page import="java.util.*,java.text.*"%>
<%@ page import ="java.util.Locale.*" %>

<%
String sql1 ;

ResultSet results;
PreparedStatement sql;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbcdbcf","scott","ttlscott");

try
{
int sec_no,catg_code;
float face_val,pur_val,int_paid,int_recd,brkr,tot_val,vou_amt;
java.util.Date vou_date,due_date1,due_date2,mat_date;
String vou_no,lf_no;

boolean doneheading = false;

Statement s=conn.createStatement();

String Security_No = request.getParameter("secno");
String Ledger = request.getParameter("lfno");


conn.setAutoCommit(false);

PreparedStatement pstmt = conn.prepareStatement(
("INSERT INTO SEC_MAST_03092004 VALUES (?, ?, ?, ?, ?, ?,?,?, ?, ?, ?, ?, ?,?,?,?)"));



pstmt.setInt(1,Integer.parseInt(request.getParameter("secno")));



pstmt.setInt(2,Integer.parseInt(request.getParameter("catcode")));


pstmt.setFloat(3,Float.parseFloat(request.getParameter("facevalue")));


pstmt.setFloat(4,Float.parseFloat(request.getParameter("purvalue")));


pstmt.setFloat(5,Float.parseFloat(request.getParameter("intpaid")));


pstmt.setFloat(6,Float.parseFloat(request.getParameter("intrecvd")));

pstmt.setFloat(7,Float.parseFloat(request.getParameter("brokrage")));


pstmt.setFloat(8,Float.parseFloat(request.getParameter("tvalue")));

pstmt.setString(9,request.getParameter("vouno"));

SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
sdf.setLenient(false);
vou_date = sdf.parse(request.getParameter("voudate"));
pstmt.setDate(10, new java.sql.Date(vou_date.getTime()));

pstmt.setFloat(11,Float.parseFloat(request.getParameter("vouamt")));



SimpleDateFormat sdf1 = new SimpleDateFormat("dd/MM/yyyy");
sdf1.setLenient(false);
due_date1 = sdf1.parse(request.getParameter("due1"));
pstmt.setDate(12, new java.sql.Date(due_date1.getTime()));

SimpleDateFormat sdf2 = new SimpleDateFormat("dd/MM/yyyy");
sdf2.setLenient(false);
due_date2 = sdf2.parse(request.getParameter("due2"));
pstmt.setDate(13, new java.sql.Date(due_date2.getTime()));

pstmt.setString(14,request.getParameter("lfno"));

SimpleDateFormat sdf3 = new SimpleDateFormat("dd/MM/yyyy");
sdf3.setLenient(false);
mat_date = sdf3.parse(request.getParameter("maturity"));
pstmt.setDate(15, new java.sql.Date(mat_date.getTime()));

pstmt.setString(16,request.getParameter("fk_vou_no2"));




pstmt.executeUpdate();

conn.commit();
conn.setAutoCommit(false);
conn.setAutoCommit(true);

sql = conn.prepareStatement("select * from SEC_MAST_03092004");

ERROR:-


HTTP Status 500 -

------------------------------------------------------------------------------- -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.NullPointerException
java.util.Calendar.setTime(Calendar.java:902)
java.text.SimpleDateFormat.format(SimpleDateFormat.java:782)
java.text.SimpleDateFormat.format(SimpleDateFormat.java:775)
java.text.DateFormat.format(DateFormat.java:314)
org.apache.jsp.MENU.security_005fmaster.security_005fsave1_jsp._jspService(secu rity_005fsave1_jsp.java:210)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.


------------------------------------------------------------------------------- -

Apache Tomcat/5.0.30