This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Define your bean as an attribute with getter/setter methods in the action going to the page for property tags. If it is for a form element you will want to define the attribute in the action going to the page and the action processing the submission of the page. When OGNL sees the property referencing fooBean it will look for a reference to it and find it in the action with the getFooBean() method.
Why do you want to do that. I think you should try/have a look "ModelDriven" interface.
Joined: Dec 21, 2009
In our case we decided not to use ModelDriven because we have situations where an action has the ability to transfer control to more than one jsp. In that case 'getModel()' wouldn't work very well if you have a different bean for each page.
It was just a matter of choice, but you are right that ModelDriven is a good alternative.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Struts2 - How to declare name/scope for a Bean