Hi
I'm running a simple web app which use tiles to keep the layout consistent trough the whole web.
Now, my "header" tile, defined as usual in the tiles defs xml, is a header.jsp file. My plan is that this particular jsp should show a menu with some options for the user.
So far so good, however, I plan to fetch the data to show in the menu from a database. This will demand locig in an action, a population of a formbean and then logic to pluck out the data from that formbean in the header.jsp to create the menu.
This, in turn, creates the need of a "common" formbean which contains the menu data troughout the application, because i will have to actually pluck out the data from the same formbean, no matter what other action was ran.
My application use an abstract self implemented superclass (BaseAction, which extends a normal struts action) for my actions, so that I can implement common logic (like login etc) for the web as a whole in this one.
I am in the dark though on how to implement a "common" formbean which the header.jsp can always read to create the menu for me.
How would I go about creating a formbean that lies in the session scope, that the header.jsp reads and the first initial action fires up and populates for me?
(That is, how to i actually use it in the jsp? And how do I actually set a bean into session scope, making it usable for jsp's as a normal session scoped formbean?).
Sorry for the lenghty question, but I hope I have explained the problem well enough for a fairly simple answer from some of you gurus out there.
Regards
I'm running a simple web app which use tiles to keep the layout consistent trough the whole web.
Now, my "header" tile, defined as usual in the tiles defs xml, is a header.jsp file. My plan is that this particular jsp should show a menu with some options for the user.
So far so good, however, I plan to fetch the data to show in the menu from a database. This will demand locig in an action, a population of a formbean and then logic to pluck out the data from that formbean in the header.jsp to create the menu.
This, in turn, creates the need of a "common" formbean which contains the menu data troughout the application, because i will have to actually pluck out the data from the same formbean, no matter what other action was ran.
My application use an abstract self implemented superclass (BaseAction, which extends a normal struts action) for my actions, so that I can implement common logic (like login etc) for the web as a whole in this one.
I am in the dark though on how to implement a "common" formbean which the header.jsp can always read to create the menu for me.
How would I go about creating a formbean that lies in the session scope, that the header.jsp reads and the first initial action fires up and populates for me?
(That is, how to i actually use it in the jsp? And how do I actually set a bean into session scope, making it usable for jsp's as a normal session scoped formbean?).
Sorry for the lenghty question, but I hope I have explained the problem well enough for a fairly simple answer from some of you gurus out there.
Regards