This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

updation..error..  RSS feed

 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!