Hi,
Im trying to modify user information on my site.for this im using java and jsp.when the user enters id,his info stored in db is to be retrieved and displayed in corresponding textboxes.
I know how to access db but dont know how to put the value retrieved into textboxes then edit if desired..and then store back..can you help?..thx

Hi,
Im trying to modify user information on my site.for this im using java and jsp.when the user enters id,his info stored in db is to be retrieved and displayed in corresponding textboxes.
I know how to access db but dont know how to put the value retrieved into textboxes then edit if desired..and then store back..can you help?..thx

First Retreive the values from database and store it in temporary variables

Now Consider a Text box whose html code is
<input type="text" name="txtUser" />
For Ex. consider user name is retreived from db
In order to assign a user string value, do this..
<input type="text" name="txtUser" value="<%=user%>" />
Now the text box will display the User name retreived from database....

For Editing,
Just get the variables in the server file using request.getParameter() method
For Ex. to get the user name use
String user = request.getParameter("txtUser");
Similarly get all the variables necessary to store it in database and update it in database....

oh and one more thing..im taking user id in one page and checking if its valid...if so then the record corresponding to it is to be displayed in next page..now how would the class know which file to put the retrieved info in?..im taking user id in page1 but retrieved record is to be displayed in page2 and edited..

Use beans and sessions, also please do not connect to DB from JSP use servlet for it. If you need any questions in regard if it just ask...

This article has been dead for over six months. Start a new discussion instead.