• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Redirecting or Forwarding to another Portlet with Params

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Vipul
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 !
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Vipul",
Please check your private messages.
-DOM
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic