Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

populating dropdown box dynamically in jsp

 
biswajit ray
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, according to ur condition:

<%MyDataBean myDataBean = new MyDataBean();
if(myDataBean != null)
{%>
<select>
<option><%=myDataBean.getUserName()%></option>
</select>
<%} else {%>
<p>No data available !</p>
<%}%>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic