aspose file tools*
The moose likes JSP and the fly likes updation..error.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "updation..error.." Watch "updation..error.." New topic
Author

updation..error..

jyotsana dang
Ranch Hand

Joined: Sep 26, 2003
Posts: 135
this jsp page throws a number format exception when updating the records..
The first page will display the previously stored record.
<%
Connection con=null;
java.sql.Statement stmt=null;
ResultSet rs=null;
boolean y=false;
int i;
String xy=(String)session.getAttribute("y");
System.out.println("select Desg,Email_id,EPABX,Home_Page from login where user_login='"+xy+"'");
String Desg="";
String Email_id="";
String address="";
String Home_Page="";
int EPABX=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc dbc:mech_iit");
stmt=con.createStatement();
rs=stmt.executeQuery("select Desg,Email_id,EPABX,Home_Page from login where user_login='"+xy+"'");
if(rs.next())
{
Desg=rs.getString("Desg");
Email_id=rs.getString("Email_id");
EPABX=rs.getInt("EPABX");
Home_Page=rs.getString("Home_Page");
}
}
catch(Exception e)
{
System.out.println("exception in block"+e);
}
System.out.println("Desg="+Desg);
System.out.println("Email_id="+Email_id);
System.out.println("EPABX="+EPABX);
System.out.println("Home_Page="+Home_Page);
%>

The next page updates the records.
<%
Connection con=null;
java.sql.Statement stmt=null;
java.sql.ResultSet rs=null;
boolean x=false;
boolean y=false;
int i;
String xy=(String)session.getAttribute("y");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc dbc:mech_iit");
stmt=con.createStatement();
String Desg=request.getParameter("Desg");
String Email_id=request.getParameter("Email_id");
String Home_Page=request.getParameter("Home_Page");
int EPABX=Integer.parseInt(request.getParameter("EPABX"));
if(rs.next())
{

out.println("update login set Desg='"+Desg+"',Email_id='"+Email_id+"',Home_Page='"+Home_Page+"',EPABX="+EPABX+" where user_login='"+xy+"'");
rs=stmt.executeQuery("update login set Desg='"+Desg+"',Email_id='"+Email_id+"',Home_Page='"+Home_Page+"',EPABX="+EPABX+" where user_login='"+xy+"'");
System.out.print("Desg"+Desg);
System.out.print("Email_id"+Email_id);
System.out.print("Home_Page"+Home_Page);
System.out.print("EPABX"+EPABX);
}
}

catch(Exception e)
{
System.out.println(e);
}
%>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61054
    
  66

What legwork have you done on your own? Have you narrowed down the location that is throwing the exception? What are you doing on this page (which has WAY too much Java on it for JSP page, by the way) that could possibly throw this exception?
You'll get the most help out of this forum when you make an effort yourself.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jyotsana dang
Ranch Hand

Joined: Sep 26, 2003
Posts: 135
iam getting a null in the next update page..
it doesnt go in the if(rs.next()) to update the record and gives null as the output.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: updation..error..