This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Parameter Interceptor  behaviour in case of Model driven Action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Parameter Interceptor  behaviour in case of Model driven Action" Watch "Parameter Interceptor  behaviour in case of Model driven Action" New topic
Author

Parameter Interceptor behaviour in case of Model driven Action

raj malhotra
Ranch Hand

Joined: Feb 22, 2007
Posts: 285
HI,
If i use Model driven action and use model to store the data ,How Parameter Interceptor knows that it should look for setters in the model and not in the Action class?I tried to look into the source code but did n't get , how its working?
Thanks for reading this

Thanks,
Raj
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If an action implements ModelDriven the results of the getModel() call are pushed onto the value stack.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
And in case David's response wasn't clear, when the Model is pushed on the Value Stack, it sits above the Action. When both the Model and Action expose the same property, the one in the model will effectively hide the one in the action.
raj malhotra
Ranch Hand

Joined: Feb 22, 2007
Posts: 285
Thanks Mark and David, so what i understood is that Interceptor will always call setter on valuestack and for them it does not matter whether it is model or Action itself.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Correct: until the value is found the calls will proceed down the valuestack until there's nothing left to try.
 
 
subject: Parameter Interceptor behaviour in case of Model driven Action
 
Similar Threads
Redirect url with in the action class
|Solved| - How to configure Global Interceptor?.. (Struts2)
ModelDriver Interceptor + not getting my object
Struts2 ModelDriven Not Threadsafe?
Some questions about the Scoped Model Driven interface of Struts 2