Using Simple portlet Link (inter portlet communication) by Clicking on button instead of link

I have two portlets (let say A and B) in same project and I am trying to send a String variable from Portlet A to Portlet B. Though I am successful in doing so using Portlet Simple Link.But now I want to implement the same in such a way that instead of Clicking on Link , I should click on a button to send data from Portlet A to Portlet B. Can anyone Suggest a solution ?

You may use the “Control/Scripts/Portlet Url Script” control to navigates to a portlet URL in response to a parent control’s (or the specified for control’s) onclick client-side event.

I tried “Portlet Url Script” as well but still failed. Following are the steps I replicated :

  1. dropped ‘Portlet Url Script’ in PortletA.
    a. General → For : disjointForm:button (this is the button on which I want to Click)
    b. General → Form Method : POST
    c. General → Form Target : PortletBDefaultviewView (PageBean name of target Portlet)
    d. General → Context : form
    e. Script → Event : OnClick
  2. dropped Extended Portlet URL inside “Portlet Url Script”
    a. Portlet URL → Type : action
    b. Portlet URL → Window state → normal
    c. Portlet URL → Portlet mode → view
  3. Dropped “Extended Portlet URL” inside parent “Extended Portlet URL”
    a. Portlet URL → Type : action
    b. Portlet URL → Window state → normal
    c. Portlet URL → Portlet mode → view
    d. Portlet URL → Portlet: caf.codeTable.PortletB (Alias name of Target Portlet defined on MWS)
    e. Portlet URL → Target Action : actionLoadFile (Method i need to call on target Portlet)
  4. Dropped ‘Extended Portlet Parameter’
    a. General → Name: filename
    b. General → Value : #{FileSelectorDefaultviewView.selectedFilename}

I also tried to send above parameters using ‘Portlet Url Script Parameter’ but still I am failing to communicate with Portlet B.

1a) What type of control is “disjointForm:button”? You would probably want to use a “Control/Output/Button” control in this case so it doesn’t get any of the specialized behavior of the other Button controls that you don’t need.

1b) If you want the exact same behavior as the ‘Portlet Simple Link’ control, then the Form Method should be GET

1c) The ‘Form Target’ is not the name of the managed bean, it is the name of the browser window (or iframe) the result should be displayed in. So you probably want to leave this blank so it does the navigation in the same window.

1d) If you want the exact same behavior as the ‘Portlet Simple Link’ control, then the Context value should be “link”

The Settings from 2 and 3 should be merged together. I don’t see any need for nesting another 'Extended Portlet URL" into the parent for this use case. The settings from #3 can be set directly on #2 instead. There can be only one “action” for a request, and the way you had it before was somewhat confusing since there were two “Extended Portlet URL” items declared as an action type.

Hello Mr. Norman,

Thanks for the Solution. Its working now :slight_smile:

Anand Advani