This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Struts and the fly likes Getting ActionForm values from Java class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting ActionForm values from Java class" Watch "Getting ActionForm values from Java class" New topic
Author

Getting ActionForm values from Java class

Bloo Barton
Ranch Hand

Joined: May 09, 2005
Posts: 63
When I need to get a value into a Java class from an ActionForm I generally just pass it in from my Action class. Since the Action class is always passed in the ActionForm item mapped to the action class I can easily get grab my desired value and pass it along.

Now though I am calling a class from an Action class, but I want to pass in another variable that is residing in an unrelated form that is session scoped. I need this value since it is required by a stored procedure for security validation.

How can I get an arbitrary session variable's value like this?
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31571
    
185

Bloo,

This gets you an arbitrary form from the session. Then name to pass in is whatever you used in the struts config file.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting ActionForm values from Java class