• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts 2 - Setting hidden properties and retrieving in an action

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic