Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 30th, 2004, 03:16 AM
Authorized User
 
Join Date: Oct 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default addBatch() prob..........

hey i have used addBatch metho..but its coming error of null exception
pstmt = conn.prepareStatement("INSERT INTO gl_mast VALUES (?, ?, ?, ?, ?, ?)");
for (int n = 0; n < 100; n++) {
pstmt.setInt(1,Integer.parseInt(request.getParamet er("gl_code1[n]")));
pstmt.setString(2,request.getParameter("gl_descr1[n]"));
pstmt.setFloat(3,Float.parseFloat(request.getParam eter("db_amt1[n]")));
pstmt.setFloat(4,Float.parseFloat(request.getParam eter("cr_amt1[n]")));
pstmt.setString(5,request.getParameter("gl_type1[n]"));
pstmt.setFloat(6,Float.parseFloat(request.getParam eter("gl_pct1[n]")));

pstmt.addBatch();
}
pstmt.executeBatch();

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: null
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.lang.NumberFormatException: null
java.lang.Integer.parseInt(Integer.java:436)
java.lang.Integer.parseInt(Integer.java:518)
org.apache.jsp.MENU.gl_005fmaster.gl_005fsave_jsp. _jspService(gl_005fsave_jsp. j ava:82)
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


it retrieves values from below text

<input type="text" name="code" size="5" maxlength="5">
<input type="text" name="Description" size="55">
<input type="text" name="DrAmount" size="12" >
<input type="text" name="CrAmount" size="12"">
<input type="text" name="type" size="12"">

and this rows is increased for entering data..and its values like that..
Each time when adding a new row, the names are "incremented" following the pattern

1st row

name="code"
name="Description"
name="DrAmount"
name="DrAmount"
name="CrAmount"
name="type"

2nd row - new created

name="code_1"
name="Description_1"
name="DrAmount_1"
name="DrAmount_1"
name="CrAmount_1"
name="type_1"

3rd row - new created

name="code_1"
name="Description_1"
name="DrAmount_1"
name="DrAmount_1"
name="CrAmount_1"
name="type_1"






Similar Threads
Thread Thread Starter Forum Replies Last Post
validationsummary prob leo_vinay ASP.NET 1.0 and 1.1 Basics 1 October 7th, 2005 12:39 PM
prob in retrieving abhit_kumar MySQL 1 December 24th, 2004 09:03 AM
updation prob.......... abhit_kumar JSP Basics 0 December 14th, 2004 08:07 AM
updation prob.......... abhit_kumar MySQL 0 December 14th, 2004 08:06 AM
prob........ abhit_kumar Java Databases 3 December 4th, 2004 03:21 PM





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