• 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

how to iterate a ArrayList in a session+struts2

 
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I stored an ArrayList in a session...



in my Jsp I say...

<s:select theme="simple" disabled="true" requiredposition="left"
list="#session.fruits" id="fruitid" name="fruitList" ></s:select>

what should be the correction here?

 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Exactly what is wrong? Are you seeing an error or are you just not getting the expected behavior?
I'd expect disabled="true" to make the control do nothing.
The "name" parameter is going to be the name of the control and also the name of the property on the action that will get set. I would not expect that property to be named "fruitList". I'd expect something like "fruit" or "fruitId".
What does the list fruits contain? Fruit objects or String objects?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(If it's a multi-select it should be "fruits" :)

Please see ItDoesntWorkIsUseless.

 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

What does the list fruits contain? Fruit objects or String objects?



It contains the list of all fruits...

Exactly what is wrong? Are you seeing an error or are you just not getting the expected behavior?



It's saying list="#session.fruits" is not valid declaration... what should it be?
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can somebody show the correction?I mean the list declaration is incorrect I think...
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try wrapping it in the %{} OGNL escape. If that doesn't do it, maybe try turning off JSF expression evaluation. If that doesn't do it, post a minimal, complete action/JSP that reproduces the problem, and I'll try it locally. Also, make sure that you can access *any* scoped attributes, preferably both request and session objects, in a *new* JSP page with a new action.
 
reply
    Bookmark Topic Watch Topic
  • New Topic