Open mulitple instances of a portlet

hi All,

From one parent portlet, is it possible to open two instances of a child portlet keeping all the data seperate from each other even though they are of same portlet type.

Once 2 instances of the same child portlet are opened, all the requests(command button actions etc) in instance B should be processed independently from Instance A data.

Please find the attached sample wherein I am trying to open two instances of a child portlet. After opening Instance A, if I click on ‘Open instance B’ button - instead of creating seperate instance it is displaying instance A data (I am able to say this by checking hashcode of the managed bean).

Kind regards,
Raja sekhar Kintali
MultiInstancesPortletProject.zip (22.1 KB)

No, it is not possible to open two distinct copies of the same portlet instance. The server-side would not have any way to know which copy a specific request should be directed to.

You would probably need to have two different instances of the child portlet type to keep them separate (each has a unique id).

Hi Eric,

may I please know how to have two different instances of child portlet type?

Kind regards,
Raja sekhar Kintali

You would just create a folder somewhere in MWS and then publish two instances of your portlet type to the folder (+ usually assigning an alias for easier lookup). Each portlet instance would have a unique id so it would maintain it’s own portlet state.

hi Eric,

Thanks for your inputs. In my application, opening new instance of a portlet in a new window is a recurrant action. Each new portlet instance will have a link to open another instance of the same portlet in a new window (of course, with different data) and all the requests (command buttons actions etc) in each portlet instance should be processed independently to other instances of same portlet type.

If I follow the suggested approach, I might need to create these public folders dynamically at run time using webMethods API (based on number of times new portlet instances are requested by user), add portlet type to the newly created folder, use the new instance and delete the folder once it is used.

In the above mentioned usecase, is it a feasible solution or is there any other alternative which I can follow to handle this scenario?

Kind regards,
Raja sekhar Kintali

You may want to reconsider the design of your UI. Opening lots of new windows is a poor choice from a usability standpoint. There is probably a way to accomplish the same end goal with a different UI pattern.

For example, if you are using MWS 8.x with workspaces, you can use the Noodle javascript APIs to add a new portlet instance to the current workspace when a link (or button) is clicked. This would ensure that all the copies have a unique portlet instance and everything would remain in one browser window.

For example, the onclick handler for a button or link could do this:


var page = Noodle.page;
page.addPortlet("/portlet/wm_yourappname___yourportletname", {
    name: "Portlet Name Here",
    metadata: {
        customPreferenceNameHere: "Custom Preference Value Here"
    }
});

See:
http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite8-2_sp2/My_webMethods/8-2-SP1_CAF_Noodle_JavaScript_Reference/index.html