of course i meant
Object data = request.getPortletSession().getAttribute("sharedData");
an edit function would be great ... :-)
for string values just use:
PortletURL url = response.createActionURL(); url.setParameter(?paymentMethod?,?creditCardInProfile?);
I'm not sure in which order you want to pass those objects.
If render --> action
Your concerns are correct. Render phase for a portlet can be triggered multiply times with unpredictable order beetween portlets on the same page and you have no influence on this.
If action --> render
You simply use ActionRequest.setAttribute(), RenderRequest.getAttribute() or ActionRequest.setRenderParameter() which is better practice than using a session
thanks for your answer.
The order is:
1. processAction() portlet A
2. render() portlet A
3. render() portlet B
4. render() other portlests C,D, ...
I'm porting a MVC web framework (WebWork 1) into a portlet. The classical MVC approach is based on one atomic request-response cycle. The action class needs the input parameters, creates a ValueStack (the action's result) which is passed to the jsp pages via request attributes. In the portlet I have to split this process into two phases, namely the processAction and the render phase. Therefore I need a way to pass the ValueStack from the processAction phase to the render phase.
I think render params are no solution for my problem because first I don't want to make results directly visible for the user and second it's practically impossible to set java objects as render objects.
you do ActionRequest.setAttribute(Object o) and RenderRequest.getAttribute(...)
Consider using MVC web framework that has bridge/support for portlets. JSF and struts has some.
And read portlet specification (jsr-168) - it's not very long and really readable ;)
I may be wrong, but I think by using your suggested commands the Object o won't be accessible in the RenderRequest. If it were I'd happily use this method of sharing objects between the methods.
The only way is to use ActionResponse::setRenderParameter(String). Then the renderparameter is simply added to the url used for redirect (/portal/default/?renderparam1=value).
Render and ActionREquest are two different HTTPServletRequest and not sharing any objects. Thats at least what I remember from JSR 168 :-)
JSF and struts are no real alternatives because the current system is based on webwork 1. I used the StrutsBridge as some kind of inspiration though.
arf... ok. of course your right. I wrote the anwser to fast and it is wrong. sory for that.... very stupid from my side.