aspose file tools*
The moose likes Struts and the fly likes Struts 2 - Setting hidden properties and retrieving in an action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 - Setting hidden properties and retrieving in an action" Watch "Struts 2 - Setting hidden properties and retrieving in an action" New topic
Author

Struts 2 - Setting hidden properties and retrieving in an action

Mark Brownengland
Greenhorn

Joined: Apr 30, 2006
Posts: 26

Having spent the last 3/4 hour doing something relatively straightforward, I would appreciate some advice. In the past, I've created a jsp containing hidden attributes. I've then retrieved them from an action and made use of their value.

For some reason, I have an action which does not appear to be picking up the hidden attributes from request scope.

The snippet from the jsp in question containing the hidden attribs is as follows:



when submitting this form via the input, this forwards to the action viewA, executing method aMethod. A snippet from this action:



If I debug in Eclipse, I can see these hidden attributes in the request's parameter map. This was also the case in the other action which works.

For some reason, calling get for attrib1 & attrib2 results in null values.

Would appreciate any pointers as to why this may be happening.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Well, you're setting locals--they're not what would be returned by a getter method.

That aside, retrieving values from the request map is pretty non-canonical Struts 2 usage, and bypasses the (very handy) type conversion it provides for free for most use-cases.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 - Setting hidden properties and retrieving in an action