This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
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://aspose.com/file-tools
 
subject: populating dropdown box dynamically in jsp
 
Similar Threads
help me regarding this selection box problem...
ASP with JavaScript
drop down box using struts
Question on RELOAD of JSP page AFTER facesMessage fixed
Dependent dynamic drop downs