2 comboboxes values of 2nd depends on 1st ,OPTION values from Database
Expand Post »
hi all!
i am new to jsp, i have two comboboxes,in which values of 2nd combo box are linked two first combo box and we get values for both these boxes from database.
Note: Both Values of combobox are to be retrieved from database.
when user select itemname corresponding values of pname should be displayed. I went through google and some threads of this forum and found some info but there option values are not retrieved from database(given in code itself), but i'm puzzled from retrieving 1st combo values and select one to retrieve the values of 2nd combo.
Hope i have made my question clear. Thank You all!
Re: 2 comboboxes values of 2nd depends on 1st ,OPTION values from Database
Quote ...
Can I see you code please? Start to code and post your problems. Definitely, we will help you.
Many thanks. Well i started coding and succesful in retrieveing first combox values from database and stored the selected value in a hidden type input now i dunno know to proceed frm here.
my problem is that, i will use <form action="servlet "> and retrieve values from database using selected value in combobox1 (getParameter()).now how can i send back these reteieved values of combobox 2 back to jsp...??
Re: 2 comboboxes values of 2nd depends on 1st ,OPTION values from Database
Use Ajax for your reqirement
i am giving solution to your problem
first create 2 jsp for your reqirement
first you show the one list itemname in the first jsp page
when user select the option from the list ,call ajax function in the
first jsp page ,and reterieve the value from the database according
to the itemname
i show the code
this is your first jsp page itemname.jsp
Re: 2 comboboxes values of 2nd depends on 1st ,OPTION values from Database
Quote ...
Use Ajax for your reqirement
i am giving solution to your problem
first create 2 jsp for your reqirement
first you show the one list itemname in the first jsp page
when user select the option from the list ,call ajax function in the
first jsp page ,and reterieve the value from the database according
to the itemname
i show the code
this is your first jsp page itemname.jsp
Thank You amarjeetsingh for spending your valuable time on answering this.
well i heared AJAX will solve the problem but i have no time (deadline of this project) to learn AJAX. So, looking for other alternative, anyway i managed to get through your code and going to work on it.
Seems like you have given values directly , i want these values from database too. Wat's the job of this AJAX Script u given? .
Does it gets values for itemname from database?
Re: 2 comboboxes values of 2nd depends on 1st ,OPTION values from Database
hi amarjeetsingh i have coded as you said
2 Jsp pages
itemname.jsp
getproduct.jsp
the problem here is the value of itemname selected was not sent to secondpage (request.getparameter not working) this is wat i get when i run the code http://i43.tinypic.com/dwqve1.jpg
i am giving you the 2 jsp pages and access database Zipped and i put them in attachment down here, Could u please help me to run this code, i would be very greatful to you.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.