• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multi List Box Problem in Struts 1.1

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Friends,
We use <html:select name="formName" property="propertyName" disabled="true" style="width:240" size="5"
multiple="true" styleId="styleId">
</html:select>
Here we use a Hashmap to hold the data. So html ptions tag could not be used for displaying options.
1) We could not hold the data usr selected when user submits this page to another page.
2) We could not get the values of the multilist values in Action Class. It always return empty String[] array.
Please help.
 
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your using a HashMap, you can use a logic:iterate tag to write the options into the html:select tag.
You don't say what solution you came up with to get the options on screen, so it's hard to say why the selections aren't in your bean.
 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We use <logic:iterate> to iterate and display options. In the next screen we have to display whatever the options user selected. It is happening.
Now user can navigate back thru the Back button we are providing in this screen.
When user reaches the previous screen the multi list is not holding the data. This is one issue.
Now We need to capture this information in a database. So Action Class needs to access this form element. In action class it always empty.
This is the another one I need to get some help to resolve.
I declare String[] array in Form class with get and set methods
Thank you
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll call the page with the options page1 and the result page page2.
The user selections are making it from page1 to page2?, if so, your form is working, at least for that.
On page2 is a back button, which returns the user to page1, but the selected options aren't redisplayed, nor are they in the Form in the Action called by page2. I suspect the Form is in the request instead of the session, and you're probably implementing the ActionForm.reset() method in your Form. Bump the Form up to the session so it can persist across requests, and implement your own reset method (maybe resetFields() ) so you can control when it's called.
Also, the iterate tag doesn't work with the html:select tag to show selected options, it will only populate the select box. You're putting a HashMap into the request or session for the iterate tag to use, you can easily convert it to a Collection, put that in and use the options tag. Or, read the source for html:options and make your own custom tag that will work with a HashMap.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic