This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30085
    
149

Bloo,

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


[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
 
Similar Threads
Action Class
Secure session Data
Setting up form data
First struts app help! Drop-down lists
Passing values across pages for that session/user