Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 24th, 2005, 09:09 AM
Authorized User
Join Date: Oct 2004
Location: , , .
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default error while insertion...


when iam inserting data using jsp..its coming error of like that..the data is inserted in database..but displays error...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;
Connection conn=DriverManager.getConnection("jdbc:odbc:pf","s cott","ttlscott");

int sec_no,catg_code;
float face_val,pur_val,int_paid,int_recd,brkr,tot_val,vo u_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");


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

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

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

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

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

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

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

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

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


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

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

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

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


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

pstmt.setString(16,request.getParameter("fk_vou_no 2"));



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


HTTP Status 500 -

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

type Exception report


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


org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

root cause

java.text.SimpleDateFormat.format(SimpleDateFormat .java:782)
java.text.SimpleDateFormat.format(SimpleDateFormat .java:775)
org.apache.jsp.MENU.security_005fmaster.security_0 05fsave1_jsp._jspService(secu rity_005fsave1_jsp.java:210)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.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

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple insertion in Table susman Classic ASP Databases 1 October 24th, 2007 05:32 PM
string insertion MunishBhatia ASP.NET 2.0 Professional 1 July 13th, 2007 08:20 AM
a doubt regarding the insertion into the Access MuthuAL Classic ASP Databases 23 January 5th, 2006 05:24 AM
problem in date insertion abhit_kumar JSP Basics 0 December 3rd, 2004 06:07 AM
insertion sort..please amahja56 C++ Programming 1 March 1st, 2004 09:40 PM

All times are GMT -4. The time now is 04:30 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.