This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Need Big Time Help" Watch "Need Big Time Help" New topic

Need Big Time Help

kengyiam Ng

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: 641
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.

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

Joined: Aug 28, 2003
Posts: 7
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%> ;
// Now set model details combo box using
//document.forms[0].elements[1].select(); --> check syntax
//<Your LIST BOX WILL CALL TO function getModel(<pass_your_makeid> ;>

Just a suggestion...
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63354

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.
JSP Fourm Bartender

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Need Big Time Help
It's not a secret anymore!