Struts 2 decorator question
I'm building a website with struts 2. I got a decorator for the layout of my website and I fill the content according an action. I also want to use a column with some tools like login, latest messages, etc. I'm pretty new to struts and i don't have a good idea what the design for this would look like. My best guess is some sort of second action. But I don't have a clue how to add 2 actions to my decorator. Is my design approach a good one and if so how should this be implemented?
Struts 2 uses 1 action per page. Nested actions are possible. An other option is to use ordinarily includes.
You could make every action extend a BaseAction where the decorator could pull data from.
For example, if FooAction extends BaseAction, you can access the FooAction data from foo.jsp and the BaseAction data from main.jsp (your decorator). To list the latest messages in main.jsp, add a getLatestMessages() method to BaseAction.
Of course, ALL of your actions must extend BaseAction for this to work.