Hanybalo
asked on
populating a list box dynamically
Hi
I want to populate a list box dynamically with data stored in a Vector inside a Bean, is this possible?
what I am doing is using a java class to call the database store the data I need from the database table into a vector.
I can populate a table using forEach tag, so is it possible to populate a list box. if so how would I go about it?
Thanks
I want to populate a list box dynamically with data stored in a Vector inside a Bean, is this possible?
what I am doing is using a java class to call the database store the data I need from the database table into a vector.
I can populate a table using forEach tag, so is it possible to populate a list box. if so how would I go about it?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi guys, I have used something like this
<TR>
<TD vAlign=top width="10%">
<P>Select Event you want to set:<BR>
<SPAN id=event>
<SELECT style="WIDTH: 20em" size=1 name=event>
<%
Vector v = (Vector) myDBHandler.getAvailabilit yFromDB();
Test.EventTypes event;
String eventName;
for( int x =0; x < v.size(); x++)
{
event = (EventTypes) v.elementAt(x);
eventName = event.getEventName();
%>
<OPTION value="<%=eventName%>"><%= eventName% ></OPTION>
<%}%>
</SELECT>
</SPAN></P>
</TD>
</TR>
however when ever the user refreshes the page, the items in the list box get added again, is there a way of disabling the refresh button in explorer, and also the address bar, note that my application is only intended to work with explorer.
<TR>
<TD vAlign=top width="10%">
<P>Select Event you want to set:<BR>
<SPAN id=event>
<SELECT style="WIDTH: 20em" size=1 name=event>
<%
Vector v = (Vector) myDBHandler.getAvailabilit
Test.EventTypes event;
String eventName;
for( int x =0; x < v.size(); x++)
{
event = (EventTypes) v.elementAt(x);
eventName = event.getEventName();
%>
<OPTION value="<%=eventName%>"><%=
<%}%>
</SELECT>
</SPAN></P>
</TD>
</TR>
however when ever the user refreshes the page, the items in the list box get added again, is there a way of disabling the refresh button in explorer, and also the address bar, note that my application is only intended to work with explorer.
Hanybalo, if you want to use a vector then that is how you do it, but the problem is as I mentioned above, I am not going for points as the solution is very similar to the other comments.
havalchy...
Can you explain what exaclty u want to be done. I am pretty dumb :)
Can you explain what exaclty u want to be done. I am pretty dumb :)
ASKER
Thanks guys I have done it the same way you told me to do it,
Havalchy
I can see what you mean, when ever a user refreshes the page, the call to the database updates the list, and dublicates occur.
Havalchy
I can see what you mean, when ever a user refreshes the page, the call to the database updates the list, and dublicates occur.
/// surg is dynamic value of popop
///////each popop has a label and value
<select name="surgeon">
<option value="<%=val%>" <%=((val.toString().equals
</select>