• 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

ActionContext & ValueStack in struts2

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

ActionContext holds the below all

1)parameters - Map of request parameters for this request
2)request - Map of request-scoped attributes
3)session - Map of session-scoped attributes
4)application - Map of application-scoped attributes
5)attr - Returns first occurrence of attribute occurring in page, request,session, or application scope, in that order
6)ValueStack - Contains all the application-domain–specific data for the request

I am having a variable name with getter & setter in my Action class ,is that it will store in the values in both parameters & value stack as mentioned above?

 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sarada chellub wrote:I am having a variable name with getter & setter in my Action class ,is that it will store in the values in both parameters & value stack as mentioned above?


It depends whether the variable (lets say username) came in as a request parameter or not. If the request did contain a parameter named username, then username will be in the parameters as well as the value stack (as the whole action object goes into the value stack)...
 
sarada bokka
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ankit,

Thanks for your input.

You have mentioned that username will be in the parameters as well as the value stack

what's the purpose of storing the value in both (parameters & value stack)?
 
Ankit Garg
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The value will go into the value stack as its in the action and the action goes into the value stack. And as it was received as a request parameter, it will also be in the parameters map for any future actions or JSPs. If its removed from the parameters, any further action or JSP which might process the request might think that the request didn't have that parameter, this might confuse it into thinking that the parameter wasn't sent so the request should be aborted or an error message sent to the user...
 
I like you because you always keep good, crunchy cereal in your pantry. This tiny ad agrees:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic