Ben Reeves

Greenhorn
+ Follow
since Jan 23, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ben Reeves

I have looked through some examples of trying to populate one combobox depending on another but im still not sure. Im using struts,jsp,java for my project. I have the first combobox populated but now i have to populate the second combobox depending on what i have selected in the first one. I am taking the fields from a database. The following is the jsp code i have, Can someone please help me?

<TD>Origin: <html:select property="origin">
<% ArrayList list = new ArrayList();
DatabaseOperations databaseOperations = new DatabaseOperations();
list = databaseOperations.getOrigins(); %>
<%
for(int i=0; i < list.size(); i++)
{
%>
<html ption value='<%=list.get(i).toString()%>'>
<%=list.get(i).toString()%>
</html ption>
<% } %>
</html:select>
</TD>
</TR>
<TR>
<TD>Destination: <html:select property="destination">

</html:select>
18 years ago
Hi guys,

I have two comboboxes, one for origins and one for destinations. When an origin is selected, I would like the destination field to change to the destinations for that selected origin. Can someone please advise me on the best way to do this?
18 years ago
JSP
Hey, I need your help please. In my JSP i have the folloeing code:

<TD>Origin: <html:select property="origin">
<% ArrayList list = DatabaseOperations.getOrigins(); %>
<%for(int i=0; i < list.size(); i++){
%>
<html ption value='<%=list.get(i).toString()%>'>
<%=list.get(i).tostring()%>
</html ption>
<% } %>
</html:select>


Problem is i keep getting the following errors:
ArrayList cannot be resolved to a type
DatabaseOperations cannot be resolved.

DatabaseOperations is a class i have with a getOrigind method that returns a list. I have it in the correct folder in struts, can someone please help me??
18 years ago
At the moment its filling the combo box with data. I know how to retrieve data from a table. Would i need to put all the code on the jsp or can i put it in the java class?
18 years ago
JSP
Hey,
Sorry for disturbing you but im having problems trying to get data from a mysql database and displaying it in a combo box on a jsp page. I had a look at some sample code you gave on the forums, but im still not sure. Im doing an airline booking system. I want to get the list of origins from my database and put it in a combobox on my jsp. then i have a combo-box which should have a list of destinations which changes depending on the origin selected from the drop down list. Im really stuck with this, could you please help me???

Thanks,
18 years ago
JSP