Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

setting scope of variable in Struts2

Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All

can i set scope=session in struts.xml in Struts2....

i have a variable which is set to session in action class

and i want to refer that variable in my jsp as session scope in my struts tag

i have a variable say parties in my action class which is list and it is set as session scope

session.setAttribute("parties", parties);

in my Jsp
iam using struts tag, get this in session scope.

like : <td > * <s:label for="partyField" id="partyLabel" value="%{getText('party')}" /></td>
<td > <s:select name="party" id="party" list="parties" listKey="id" listValue="name"></s:select> </td>

iam getting error:

org.apache.jasper.JasperException: tag 'select', field 'list', name 'party': The requested list key 'parties' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]

please anyone try to reslove this

Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But if you're always setting the same list in session I'm not sure what you're accomplishing over making it an action property.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic