• Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

Comments (6)

1 localhost commented Permalink

Hello

 
how can I set a parameter at processAction which will not be persistant.
 
Scenario 1: action within a portlet=> processAction (set the parameter)=> doView (get the parameter)
 
Scenario 2: Portlet changing=> doView (get the parameter)
 
If I set a parameter at processAction with the method setRenderParameter it is also available at Scenario 2 at doView without calling processAction before.
 
So it's not possible to know the action which has really happen.
 
Any ideas?
 
Kind Regardsklaus

2 localhost commented Permalink

OK, I'm tired and not thinking really straight right now, but at first glance I might think we could use a session variable? set it in the processAction and clear it before you exit the doView?

 

3 localhost commented Permalink

In our testing we could not retrieve a value set by request.setAttribute in processAction once we were in doView (in the same request)The workaround is to put the value into the session instead (which will persist) but we must add an extra line to reset the value to null to ensure correct behaviour between requests.

 
processAction// set the parameter valuerequest.getPortletSession().setAttribute("myportlet.inAction","true");
 
doView// retrieve the parameter value String attr = (String) request.getPortletSession().getAttribute("myportlet.inAction");
 
// e.g. here if attr==null then reset the portlet.// this may involve setting the navigation to the start page// it may also involve resetting bean values (although you may choose not to)
 
// reset the parameter value to null as session will persist between requestsrequest.getPortletSession().setAttribute("myportlet.inAction",null);
 
I'm not a coder, so please make sure you test in your environment.

4 localhost commented Trackback

657678

5 ThejaswiniA commented Permalink

Hi ..i need to refresh the page when i navigate back to the page ... i am following this Scenario .. .. and is working fine .. unless i refresh the page .. on page refresh .. the contents are getting cleared ..please let me know.. how do i prevent this from hapening

Add a Comment Add a Comment