Hi,

coming from the PHP world I am starting to get practice with Stripes. 
And I wonder how to best communicate between JSP and my ActionBean. In 
PHP I liked to use "smarty". There one just saves all the data the 
template needs into a large HashMap und the template will work with this 
map, after the lifetime of what was comparable to the ActionBean already 
exceeded its lifetime.

I noticed that I can get the same behaviour with JSP by using
getContext().getRequest().setAttribute("name", someObject);
That works very well, but I doesn't feel like I am "supposed to do 
this". Am I? Is this a suitable approach? Or are there good reasons to 
keep hands away from this?

The other way is obviously to have some getter-methods on my ActionBean 
that I call from the JSP file. That is what I used most of the time. But 
sometime I want to calculate values for the JSP in my event handler. 
Thus I have to save them in a property of the ActionBean and introduce a 
getter method for them. That works well for small ActionBeans, but with 
a rising number of event handlers within one action bean I easily loose 
the overview which property I introduced for which event handler.

Another approach that I have seen is creating a POJO for each and every 
jsp page with all properties for that JSP page. Then this object is 
saved as a property of the actionBean and it is worked with from JSP 
(additionally this may save a little memory because only the properties 
that are actually needed by the current JSP need to be allocated).

What would you say is "best practice" and why?

Thank you,

Thomas

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to