jQuery in Action, 2nd edition*
The moose likes JSP and the fly likes Need Big Time Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Need Big Time Help" Watch "Need Big Time Help" New topic
Author

Need Big Time Help

kengyiam Ng
Greenhorn

Joined: Aug 28, 2003
Posts: 7
Dear all,
I have been trying for weeks and just could not get this solve. Please kindly advise me.
I have 2 database table: (Make: Make_Id(Pri Key), Make) and (Model: Model_Id(Pri Key), Make_Id(Foreign Key), Model).
I intend to create a JSP page which will produce two combox(combox1 and combox2). Combox1 will retrieve "make" from table Make, while Combox2 will retrieve "model" from table Model and combox2 will automatically change when combox1 change.
I have used Javascript to get the effect but still could not get it done.
Can you guys please help me out and advise me in details.
Thanks alot.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 614
Kengyiam,
If you want to skip javascript,then you will have to refresh your page on change event of combox1.
In this case you can get makid once page is refreshed onchange of combox1 and fill combox2 for this makeid.
Cheers
Praful


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
kengyiam Ng
Greenhorn

Joined: Aug 28, 2003
Posts: 7
Hi,
Let say I intend to use Javascript, how do I extract data from Make and Model table and import them to Javascript array dynamically?
Nehul NN
Ranch Hand

Joined: Nov 05, 2003
Posts: 45
When retrive data from database using JDBC, create Javascript array & put data into array.

function getModel(makeID){
var Name_of_Array= new Array(<%number_of_elements_from_db%> ;
// USE FOR LOOP TO GET YOUR MODEL DETAILS WHEN YOU FIND MATCH USING
//MAKEID.
// Now set model details combo box using
//document.forms[0].elements[1].select(); --> check syntax
}
<FORM>
//<Your LIST BOX WILL CALL TO function getModel(<pass_your_makeid> ;>
</FORM>

Just a suggestion...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60817
    
  65

Welcome to the Ranch Nehul NN!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
Thanks!
bear
JSP Fourm Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Need Big Time Help
 
Similar Threads
How to insert using hibernate?
Auto_Increment Primary Key
How mapping -> Composite Id??
Adding Values on runtime
Hashmap, retrieving value and re-storing with different key