Ima trying to create a
jsp file where users can edit their previously stored profiles which they save when they sign up for registration..
well the profile gets updated but i want that the as the users click on the edit link the edit page should show in all the textfields the previously stored values..
but iam not able to achieve success in the same..
can anyone try to figure out what went wrong??
here is the code:
in the body tag:
<%
Connection con=null;
java.sql.Statement stmt=null;
ResultSet rs=null;
boolean y=false;
int i;
String username=(String)session.getAttribute("y");
String name="";
String lname="";
String addr="";
String ct="";
String st="";
int pincode=0;
int phone=0;
String em="";
System.out.println(username);
System.out.println(name);
System.out.println(lname);
if (username == null )
username="";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc
dbc:mech_iit");
rs=stmt.executeQuery("select fname,lname,address,city,state,pincode,phone,email from personal_info where user_login='"+username+"'");
if(rs.next())
{
name=rs.getString("fname");
lname=rs.getString("lname");
addr=rs.getString("address");
ct=rs.getString("city");
st=rs.getString("state");
pincode=rs.getInt("pincode");
phone=rs.getInt("phone");
em=rs.getString("email");
}
}
catch(Exception e)
{
System.out.println("exception in block"+e);
}
System.out.println("name="+name);
System.out.println("lname="+lname);
System.out.println("addr="+addr);
System.out.println("ct="+ct);
System.out.println("st="+st);
System.out.println("pincode="+pincode);
System.out.println("phone="+phone);
System.out.println("email="+em);
%>
in the form fields :
<p><font face="Georgia, Times New Roman, Times, serif">First Name </font> <font face="Georgia, Times New Roman, Times, serif"><input name="fname" type="text" align="right"
value="<%= name%>">
thanks all
jyotsana