This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JSP and the fly likes populating dropdown box dynamically in  jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "populating dropdown box dynamically in  jsp" Watch "populating dropdown box dynamically in  jsp" New topic
Author

populating dropdown box dynamically in jsp

biswajit ray
Ranch Hand

Joined: Nov 30, 2005
Posts: 30
How do I populate a dropdown box (in a JSP - "index.jsp") using a jsp that reads from a dataBase?

At first when the user logs in his name wil be stored in the database.
And if an administraor will go for index.jsp there the name of the user will be populated automatically when the administrator will refresh the index.jsp page.
plz help me in solving this question along with code if possible
Eric Hanson
Greenhorn

Joined: Feb 08, 2006
Posts: 5
hi try this out,

<select>
<option><%=MyDataBean.getDataOne()%></option>
<option><%=MyDataBean.getDataTwo()%></option>
<option><%=MyDataBean.getDataThree()%></option>
<option><%=MyDataBean.getDataFour()%></option>
</select>

Regards,
Eric
Eric Hanson
Greenhorn

Joined: Feb 08, 2006
Posts: 5
Oh, according to ur condition:

<%MyDataBean myDataBean = new MyDataBean();
if(myDataBean != null)
{%>
<select>
<option><%=myDataBean.getUserName()%></option>
</select>
<%} else {%>
<p>No data available !</p>
<%}%>
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: populating dropdown box dynamically in jsp
 
Similar Threads
help me regarding this selection box problem...
Question on RELOAD of JSP page AFTER facesMessage fixed
ASP with JavaScript
drop down box using struts
Dependent dynamic drop downs