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!
Printable View
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!
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
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><???:confused: ????</option?
how to solve this!
this is the scenario iam speaking about!
hoping answer soon!
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>
<%
}
%>
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)!