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 ]
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.
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 ]
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 .
Do you mind sharing your solution, Vipul? I really appreciate it.
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop