User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 427,194 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,149 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 990 | Replies: 4
Reply
Join Date: Jan 2008
Posts: 49
Reputation: Ankita B is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Ankita B's Avatar
Ankita B Ankita B is offline Offline
Light Poster

Help retrieve info frm db into textbox and edit

  #1  
Feb 13th, 2008
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2008
Posts: 4
Reputation: vimalkv123 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
vimalkv123's Avatar
vimalkv123 vimalkv123 is offline Offline
Newbie Poster

Re: retrieve info frm db into textbox and edit

  #2  
Feb 13th, 2008
Originally Posted by Ankita B View Post
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....
Reply With Quote  
Join Date: Jan 2008
Posts: 49
Reputation: Ankita B is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Ankita B's Avatar
Ankita B Ankita B is offline Offline
Light Poster

Re: retrieve info frm db into textbox and edit

  #3  
Feb 13th, 2008
cool thx a lot..wil try it..
Reply With Quote  
Join Date: Jan 2008
Posts: 49
Reputation: Ankita B is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Ankita B's Avatar
Ankita B Ankita B is offline Offline
Light Poster

Re: retrieve info frm db into textbox and edit

  #4  
Feb 13th, 2008
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..
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,467
Reputation: peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough 
Rep Power: 11
Solved Threads: 296
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: retrieve info frm db into textbox and edit

  #5  
Feb 13th, 2008
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...
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the JSP Forum

All times are GMT -4. The time now is 10:21 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC