Prepare for your Next Interview
This is a discussion on combo in jsp within the JSP forums, part of the Web Development category; hi frineds i want to use a jsp page, which connects to DB and retrieves info from it(say lastname).the retrieved info should be inserted into COMBOBOX Please tell ...
|
|||
|
combo in jsp
hi frineds
i want to use a jsp page, which connects to DB and retrieves info from it(say lastname).the retrieved info should be inserted into COMBOBOX Please tell how can one do it!
__________________
:) NEVER SAY DIE. |
| Sponsored Links |
|
|||
|
Re: combo in jsp
I think in jsp page you can also use html code. Checkout the following code.
<select name="test"> <option><% = lastname(this what you getting from database) %></option> </select> ------------------ suresh |
|
|||
|
Re: combo in jsp
hi suresh
but it will return more than one row from DB! suppose it returns three rows! i am storing these three names in array like arr[]=rs.getString("lastname"); now i want to add it to combo box <select name=".."> <option><??? ????</option?how to solve this! this is the scenario iam speaking about! hoping answer soon!
__________________
:) NEVER SAY DIE. |
|
|||
|
Re: combo in jsp
Hi ,
I dont know whether u r using any framework or following any architecture. If u r not using any framework or CustomTags , u can adapt the procedure given below. If u have a collection or an array of objects iterate them using a loop and add these values to a combobox. You can write a Scriplet to do this. for wg:- if you have an array names of size 10 i.e., names[10] then u can iterate u r array in this way <% for(int i=0,n=names.length[];i<n;i++){ %> <select name="test"> <option><% = names[i] %></option> </select> <% } %> Last edited by pramod.reddy : 03-19-2007 at 06:04 AM. |
| The Following User Says Thank You to pramod.reddy For This Useful Post: | ||
|
|||
|
Re: combo in jsp
thanks pramod!Though i got the solution that day itself, i forgot to write here!
But still too much thanks! Hope you will help me in other problems too(as i come across)!
__________________
:) NEVER SAY DIE. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Select a different value from the combo box | JobHelper | WinRunner | 1 | 12-26-2006 11:17 AM |