wood burning stoves*
The moose likes Portals and Portlets and the fly likes Redirecting or Forwarding to another Portlet with Params Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "Redirecting or Forwarding to another Portlet with Params" Watch "Redirecting or Forwarding to another Portlet with Params" New topic
Author

Redirecting or Forwarding to another Portlet with Params

Vipul
Ranch Hand

Joined: Apr 27, 2005
Posts: 38
Hi ,

I am trying to redirect(invoke the processAction of the current portlet) to a different portlet from a hyperlink in a portlet with some params . Please let me know the best way to achieve this .

My Env :
IBM Portal 6.1
JSF Portlet

Is there a way to use <portlet:actionURL/> for a hyperlink (which is generated from a JSF output tag). and when I click the link I want to call the processAction method of the current portlet . I have the code to find the portlet from JNDI and forward to it .

I am just stuck in way to invoke the processAction method of the current protlet using a hyperlink.

Thanks!
[ October 14, 2008: Message edited by: Vipul ]
Dharmesh Chheda
Ranch Hand

Joined: May 08, 2001
Posts: 204
Hi Vipul

From what I understand, you have a link in your portlet A. On click of that link you want to call processAction of Portlet A and then later redirect to Portlet B..

If this is what you are looking you can try out this solution.

Step 1> In the JSP of Portlet A, use the wps:captureContent tag to capture link pointing to Portlet B. For this you need to export the page details on which the Portlet is residing to get the object id's of the page and the portlet on it.

Step 2> your wps:captureContent tag will look something like this



Consider PARAM1 to be the value that you need to pass to portlet B. In case you want to pass a value that the user has submitted you can do it in the processAction of Portlet A.(in such case you can consider VALUE1 as a placeholder.)

At this point you now have a link pointing to portlet B with the necessary params encoded in the URL.This will be your redirect URL , the one where you will redirect to from Portlet A processAction method.

Step 3> Capture this value in a javascript variable.


serverBaseURL is the detail of the URL before the relative part of the URL.

Step 4> have a form action that, on submit will invoke processAction of Portlet A and have a property for the redirectURL.


Step 5> on click of form submit, get hold of the form and set the redirectURL to its property and let the control will go to processAction of Portlet A. Once that is done in the processaction you can get the redirect URL as one of the form element.

Step 6> do what you want in your processAction. In case you want to push in new values to the params, you can locate the String "VALUE1" in the redirect URL and update it with the value you want to pass.

Step 7> do response.sendRedirect(redirectURL);

Hope this helps
[ October 17, 2008: Message edited by: Dharmesh Chheda ]

regards,<br />Dharmesh Chheda
Vipul
Ranch Hand

Joined: Apr 27, 2005
Posts: 38
Thanks Dharmesh ! I have this working by creating a submit button instead of a link and when the page is submitted the processAction method is called where i redirect it to other portlet B .

But I will try your solution to get it work for a link .

Thanks !
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"Vipul",
Please check your private messages.
-DOM
j ma
Greenhorn

Joined: Dec 08, 2008
Posts: 1
Originally posted by Vipul:
Thanks Dharmesh ! I have this working by creating a submit button instead of a link and when the page is submitted the processAction method is called where i redirect it to other portlet B .

But I will try your solution to get it work for a link .

Thanks !


Do you mind sharing your solution, Vipul? I really appreciate it.

Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Redirecting or Forwarding to another Portlet with Params
 
Similar Threads
Simple Weblogic Portlet Question
how to call processAction() method from icefaces ,in liferay
RendarReq.getAttribute() displaying always null which is set by ActionReq.setAttribute()
Getting aRequest params to doView
Portlet to Portlet Help