jsp code compilation error
hai, iam doing online banking project.i created two database tables in mysql.Table1: user (username,password) Table2: myaccounts (accno,username,balance).
for funds transferring, i had written the following code.but it shows the following error.can you tell me where is the error and also what is the proper code for funds transfer.
<%@page import="java.sql.*"%>
<%
int acc1=Integer.parseInt(request.getParameter("no"));
int bal=Integer.parseInt(request.getParameter("amount"));
int acc2=Integer.parseInt(request.getParameter("to"));
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register";, "root", "root");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery( "select balance from myaccounts where ano='"+acc1+"'");
int balance1=0;
while (rs.next()) {
balance1=rs.getInt("balance");
}
ResultSet rs1 = st.executeQuery( "select balance from myaccounts where ano='"+acc2+"'");
int balance2=0;
while (rs1.next()) {
balance2=rs1.getInt("balance");
}
int bal1=balance1-bal;
int bal2=balance2+bal;
st.addBatch("update myaccounts set balance="+bal1+" where ano='"+acc1+"'");
st.addBatch("update myaccounts set balance="+bal2+" where ano='"+acc2+"'");
st.executeBatch();
out.println("Transaction has been successfully done.");
}
catch(Exception e){}
%>
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.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.NumberFormatException: null
java.lang.Integer.parseInt(Integer.java:415)
java.lang.Integer.parseInt(Integer.java:497)
org.apache.jsp.xxxxxxxxxxxxxxx_jsp._jspService(xxxxxxxxxxxxxxx_jsp.java:62)
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.
View Answers
January 5, 2010 at 10:49 AM
Hi Friend,
Try the following code:
<%@page import="java.sql.*"%>
<%
int acc1=Integer.parseInt(request.getParameter("no"));
int bal=Integer.parseInt(request.getParameter("amount"));
int acc2=Integer.parseInt(request.getParameter("to"));
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:
mysql://localhost:3306/register";, "root", "root");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery( "select balance from myaccounts where accno='"+acc1+"'");
int balance1=0;
while (rs.next()) {
balance1=rs.getInt("balance");
}
ResultSet rs1 = st.executeQuery( "select balance from myaccounts where accno='"+acc2+"'");
int balance2=0;
while (rs1.next()) {
balance2=rs1.getInt("balance");
}
int bal1=balance1-bal;
int bal2=balance2+bal;
st.addBatch("update myaccounts set balance="+bal1+" where accno='"+acc1+"'");
st.addBatch("update myaccounts set balance="+bal2+" where accno='"+acc2+"'");
st.executeBatch();
out.println("Transaction has been successfully done.");
}
catch(Exception e){}
%>
Thanks
Related Tutorials/Questions & Answers:
jsp code compilation error - JSP-Servletjsp code compilation error hai, iam doing online banking project.i... is the
error and also what is the proper
code for funds transfer.
HTTP... The server encountered an internal
error () that prevented it from fulfilling
Advertisements
compilation error - JSP-Servletcompilation error Hi sir, i'm using following
code to upload an image to the database.I'm facing the following problem.
<%
String...(longblob)) in the database and try the following
code:
<% String
Java compilation error - JSP-Servlet*;
^
An
error occurred at line: 18 in the
jsp file: /employee_upload_profile...);
^
An
error occurred at line: 18 in the
jsp file...();
^
An
error occurred at line: 18 in the
jsp file: /employee_upload
java compilation error - JSP-Servletjava
compilation error hi,
i have created a table in MYsql and connected it using JDBC, I have to now validate those fields using
jsp, so please can you suggest me a way how to validate using
jsp, my table has fields
java compilation error - JSP-Servletjava
compilation error i have created an employee table in mysql and connected it using JDBC, now i have to do client side validations, can u please...
code java compilation error - JSP-Servletjava
compilation error i want to do client side validations using
JSP, so please can u suggest me a way out.thanq very much for the previous answers... validations.........u will find some js files download that and include i the
jsp java compilation error - JSP-Servletjava
compilation error How to compile a java Program,If i am having jdk1.5 in webligic it support jdk1.4..When i put a .class file into WEB-INF/classes/Mybeans/Datacon.class it was given a error Hi friend
java compilation error - JSP-Servletjava
compilation error i have a field like name if name is not given then it should give an alert like name cannot be null, i want this type of validations. Hi uma,
I am sending you a link. This link will help
srvlet compilation error - JSP-Servletsrvlet
compilation error while compiling a servlet, httpservlet class not found errors & many such class not are generated. Hi Friend,
It seems that compiler haven't found the servlet-api.jar file.So put
Java Compilation error - JSP-ServletJava
Compilation error hi i m vipul chauhan , i having a problem with this package
i download package from the location http://commons.apache.org...-fileupload-1.2.1.jar but still there is a problem and when i compile my file this
error java compilation error - JSP-Servletjava
compilation error sir ,i have jdk1.6.0_01 and textpad installed .I have also set classpath and path.But stil on compiling my servlet programs in textpad i get compile time errors like javax.servlet.* ,javax.servlet.http.
code error - JSP-Servletcode error hii
this program is not working becoz when the mouse... is
error in this progrm.
ss
function describe()
{
window.status...
complaint
Hi friend,
Do some changes in your
code to solve
jsp code error - JSP-Servletjsp code error hello,
is anyone here who can solve my problem.
what happen experts where r u? r u not able to do
jsp code error - JSP-Servletjsp code error hello,
is anyone here who can solve my problem.
what happen experts where r u?
or
u r not able to do
jsp code error - JSP-Servletjsp code error I have a
jsp page named "tMastDepartment".which has some table row containing text box like 'project
code','Departmentcode','employee... there is the problem which i am facing.what will be the exact
code compilation errorcompilation error Hi my program below is not compiling,when I try to compile it i'm getting the
error message "tool completed with exit
code 1... java.util.*;
import java.text.*;
class HardwareItems
{
String
code jsp code error - Java Beginnersjsp code error Hi,
I have a problem with following
code... part. Is it possible to display a message box or alert box in
jsp code??. plz help...; Hi friend ,
Try this
code:
/*out.println("Login Failed
java compilation error - Appletjava
compilation error I am getting
compilation error in the following
code.:
public void paint(Graphics g)
{
switch(screen...;
}
}
Error is:
Illegal start of expression
Plz. find why am I getting this
error JSP CompilationJSP Compilation Explain how a
JSP is compiled into servlets by the container
jdbc compilation error - JDBCjdbc
compilation error java.lang.Exception: Problem in call_select
when i am executing the program i am getting the above
error. how can i resolve it? Hi friend,
plz specify in detail and send me
code java compilation error - Hibernatejava
compilation error hi
i am getting org.hibernate.exception.GenericJDBCException: Cannot open connection exception when runnig the
code why this exception is coming
groovy compilation error - Framework]
[groovyc] 1
error
Compilation error:
Compilation Failed
how we can resolve...groovy
compilation error while i am running the grails application , i got the
error message like:
[groovyc
java compilation error - Appletjava
compilation error hi friends
the following is the awt front design program
error, give me the replay
E:\ramesh>javac...,
Plz give full details with source
code and visit to :
http
Webshpere compilation errorWebshpere
compilation error
I want clear result . Thank you
WSWS3166E:
Error: No client transport named 'http' found.
faultActor: null
faultDetail:
[10/5/10 13:19:40:937 EDT] 00000043 SystemOut O WSWS3166E:
Error compilation error - Java Beginnerscompilation error i 'm not able to compile a program :
prblem...; Post your
code. //this is person
code!!
public class Person...=dog;
}
public Dog getDog()
{
return dog;
}
}
//this is Dog
code compilation error - Java Beginnerscompilation error import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class BLayout implements ActionListener
{
JFrame f...,BorderLayout.CENTER};
for(int i = 0 ; i Hi Friend,
Try the following
code compilation error - Java Beginnerscompilation error class s
{
public static... this program it is giving an
error as integer number is too large.why? and what... not in the Hexadecimal or Octal. Here is fraction of Java
code example which will help you
Java Compilation error - SQLJava
Compilation error ava.lang.NullPointerException
at beanUtils.SaleHeaderUtility.getFullRemainPatientList(SaleHeaderUtility.java:754... post your
code.
Thanks
java compilation error - Antjava
compilation error hi, i have a application in which i m reading from an xml file and then storing its values in database.but when i started.... do let me know? Hi Friend,
Please post your
code.
Thanks
compilation error - Java Beginnerscompilation error sir what is the
error inthis
code
after executing the below
code i got
java.lang.NoSuchMethodError: main
Exception... org.array.Group
Correct
Code :
package org.array;
import java.io.
Compilation Error - StrutsCompilation Error description The server encountered an internal
error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class
compilation error - Java Beginnerscompilation error Dear sir,
When i compile some pgms i am getting below error.what may be the reason?
"uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details." Hi Friend
java compilation error - Hibernatejava
compilation error hi, i have made an registration page whosevalues should be inserted into database. i have used hibernate and eclipse it is working fine. but when i make a war file and deploy it using ant and then run
java compilation error - JDBCjava
compilation error
/*
*Project:employee.java
*Date:April 04,2007.
*Purpose:To All Java Developers
**/
package employee;
import javax.swing.*;
import java.awt.*;
import javax.swing.border.
java compilation error - Java Beginnersjava
compilation error Sir Thanx for ur response for reading a doc file but when i tried to execute ur
code compilation error occurs,
it says --> org.apache.poi.hwpf package does not exist.
-->
java compilation error - Java Beginnersjava
compilation error HELLO SIR,I HAVE ASKED QUESTION AND I GOT REPLY FOR THAT ALSO BUT I AM GETING
COMPILATION ERROR UNCHECKED OR UNSAFE OPERATION... be a deprecated method which shows that message.Even then,if you run the given
code,you
Java Compilation error - Java BeginnersJava
Compilation error I got this
error while convert java to pdf.../size
can somebody told me how to handle this
error... Hi Friend,
Please send your
code.
Thanks
Its ok...
i already solved
Java Compilation error - Java BeginnersJava
Compilation error
i wrote a simple hello world program i get this
error every time please help
Exception in thread "main...,
Please send your
code so that we can help you.
Thanks
Java compilation error - Java BeginnersJava
compilation error Hello I am having this problem while...\AccountRecord.java
I save AccountRecord.java in ch14
However I get an
error saying... your
code so that we can solve your problem.
Thanks
java compilation error - Java Beginnersjava
compilation error Dear Sir ........
I was installed the java... writing my
code through command line instead of a note pad but while compiling I'm getting the
error like file not found : exxx.java(my file name is exx),
Ill
java compilation error - Java Beginners occurs.Even then if you found
error,send the full
code.
Thanks...java
compilation error I need to know how to correct a compiler
error for my program to run. The
error I keep getting is unclosed string literal
java compilation error - Java Beginnersjava
compilation error Hello,
I'm having problems with trying to correct 2 compiler errors. The
code I'm having trouble with is listed below. It's flagging two errors for this one
code. The first
error says identifier
java compilation error - Java Beginnersjava
compilation error i am going to type program and the
error is shaded one this one is giving
error please sole this one sir
import java.io....:"+ch);
}
}
Hi friend,
Having some
error in your
code check
java compilation error - Java Beginnersjava
compilation error i am going to type program and the
error is shaded one this one is giving
error please sole this one sir
import java.io....:"+ch);
}
}
Hi friend,
Having some
error in your
code check
Compilation error in java - Java BeginnersCompilation error in java i have a properties file named... that file in java class,my
code is
Properties props = new Properties();
File... FileInputStream(f);
props.load(in);
but i got a
error the system could
java compilation error - Swing AWTjava
compilation error NestedPopupMenu n = new NestedPopupMenu();
getting
error as "local variable n is never read Hi dharani,
This is running
code. I hope that this
code will help you.
import java.util.