*
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
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