aspose file tools*
The moose likes Servlets and the fly likes JSP/JDBC problem...please help!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP/JDBC problem...please help!!!!" Watch "JSP/JDBC problem...please help!!!!" New topic
Author

JSP/JDBC problem...please help!!!!

Moined Mogul
Ranch Hand

Joined: Jul 11, 2001
Posts: 33
I have a JSP that has five text boxes in the centre of the page. Each of the text boxes represent a field in my database table. The first box is actaully a select box (not a text box), that has a drop down menu with all the items in my first column in my table of the database which is a reference number.
What I want to do is to have it so that when I select an item from the drop down menu, the corresponding columns of the same row in my table show up in the other 4 text boxes.
Could someone please let me know how to go about doing this and if possible give some example code.
Thank you in advance!!!
Trevor Dunn
Ranch Hand

Joined: Jun 13, 2001
Posts: 84
You are going to have to resubmit the page and fill those drop down boxes
Trevor
Sunetra Saha
Ranch Hand

Joined: Feb 25, 2001
Posts: 77
Submit the form to itself on changing the option. At the begining of the jsp check whether the form has been submitted. If it has, retrieve the values of the fields from the database. If you want to submit the form elsewhere then keep the second location as a redirect on the submit button.
Let me know if this is enough.
Moined Mogul
Ranch Hand

Joined: Jul 11, 2001
Posts: 33
The others are not drop down boxes though. I only want to have the one drop down box and when the user selects a ref number I want the others to be automatically filled in with the appropriate data from the same row of the table.
Shuaib Gill
Ranch Hand

Joined: May 29, 2001
Posts: 62
Perhaps using the Hashtable would help. When the user selects some option from the first drop down box, give the value of the parameter to the hashtable. For example, if the user selects the 3rd option in the drop down box, use the number 3 as a key in the hastable.
So, say something like...
Hashtable val = new Hashtabele();
int key;
Object object;
val.put(key,object);


programmer77
Moined Mogul
Ranch Hand

Joined: Jul 11, 2001
Posts: 33
Before I begin to work on what you have suggested maybe if I could just get your opinion on if this would be the best way of going about this problem???
What I am creating is pretty much an edit JSP page that allows the user to select the item they want to edit from the database and then when they do the rest of the fields show up along the left side of the page. I then have input boxes matching up with those on the left where the user can input the changed value for the column in the database.
Could someone tell me if they think this would be an alright solution to this problem. I had also thought of before Just having the one box for each column and then the user could then overwrite what was there to change the value but thought this might be more difficult to implement.
Could you please give me your opinion as to what you think would be the easiest solution to this problem.
Thank you.
 
wood burning stoves
 
subject: JSP/JDBC problem...please help!!!!