Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 - Setting hidden properties and retrieving in an action

 
Mark Brownengland
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic