I have spent a few days on this and have finally given in to asking for help. I have a JSP page that contains a combox box that I would like to populate with values coming from my DAO.
I would like to use the html ptionsCollection method to populate the combo box, however, so far I have not been successful at all. Here are the following files and code. Any assistance is really much appreciated Thanks. I am using the following files:
StoreDAO.java StoreVO.java LaborManagementForm.java (this is my struts action form) WelcomeAction.java (portlet action) Struts-Config.xml laborManagement.jsp
The first problem is that while your WelcomeAction apparently gets a list of stores, it doesn't put that list anywhere accessible to the JSP. Since you have a storeList property in your LaborManagementForm, it would make sense to put it there. So, the code in your WelcomeAction should look something like this:
The form variable above refers to the parameter of type ActionForm passed in to the execute() method.
The second problem is that your JSP makes incorrect usage of the html:optionsCollection tag. Read the heading "OptionsCollection" in this link and you will see where you went wrong. If you code your WelcomeAction as I did above, your JSP would look something like this:
[ June 12, 2007: Message edited by: Merrill Higginson ]
Thank you for your response. I have a decent idea of how this works now, however, I am getting some unusual results in my JSP page. Here is a recap of the code since I updated it. However, in my JSP page, I am only seeing one option within the select combo box. Also, the label is coming back as 'store1', which is not even one of the items in the result set. Any idea what is happening there? There ought to be 25 items appearing in the option list.
posted 13 years ago
Resolved, thanks! I changed Collection to ArrayList in my DAO and that did the trick.
What's that smell? Hey, sniff this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop