jQuery in Action, 3rd edition
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting ActionForm values from Java class" Watch "Getting ActionForm values from Java class" New topic

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

Joined: May 26, 2003
Posts: 32628


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]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link: http://aspose.com/file-tools
subject: Getting ActionForm values from Java class
It's not a secret anymore!