• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Get access to session scoped form data from a different action

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All,

I have a session scoped form that has an attribute that I'd like to get access to from an action that does not use that form as its input. I'd assume that since the form is session scoped the data has to be in there *somewhere*, but short of writing code to dump the session and trying to figure it out, I was hoping that someone could answer this off the top of their head.

Thanks,
Brantley
 
Brantley Hobbs
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In case anyone is interested, session scoped forms are stored in the session by setting a session attribute to the entire form bean. The session attribute is named with the name given to the form in the struts config file.

For example, you have a form of type "com.mydomain.FooForm" named "fooForm". If that form is session scoped, there will be an attribute in the session named "fooForm" and it will be an object of type "com.mydomain.FooForm". Once you get that object from the session, it's trivial to call getters and setters to get at the data in it.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic