Passing of Control parameetrs by command link

I have created a command link which would help to navigate to another view page in the same portlet.
Now,I want to pass some control parameters in the command link UI so that these passed parameters can be accessed in the navigated view page.
Can you please tell how to achieve it.

Hi Amit,

The way to build urls with portlet parameters is either via the PortletURL API (in java code) or via the Portlet category controls (on the view canvas).

To build a link on a jsf view that links to a different portlet with the Portlet Category controls, use the PortletLink control for the link itself, and then add an ExtendedPortletUrl control to the PortletLink's "value" facet (blue-dashed box). If the other portlet is on a different page, set the ExtendedPortletUrl's "baseUrl" property to an alias of the portlet or an alias of the page containing the portlet (in the baseUrl property value, precede the alias with a slash, like "/MyPageAlias"); if the other portlet is on the same page, leave the "baseUrl" property blank. Add another ExtendedPortletUrl as a child of the first ExtendedPortletUrl, and set the second ExtendedPortletUrl's "portlet"

property to an alias of the portlet (this time without the preceding slash, like “MyPortletAlias”).

Finally, for each parameter you want to pass to the portlet, add a PortletParameter control to the second ExtendedPortletUrl. Set the PortletParameter's "name" and "value" properties accordingly. The structure of those controls should resemble the following:

PortletLink
ExtendedPortletUrl
- baseUrl=/MyPageAlias
ExtendedPortletUrl
- portlet=MyPortletAlias
PortletParameter
- name=myParam
- value=myValue
PortletParameter
- name=myParam2
- value=myValue2

When the page is rendered, you'll end up with a link to an url like the following:

http://localhost:8585/MyPageAlias?wmp1234.myParam=myValue&wmp1234.myParam2=myValue2

The other portlet will be able to access those parameters directly as portlet properties. If the other portlet has a property called “myParam”, it’s value automatically will be set to “myValue”; and if it has a property called “myParam2”, it’s value automatically will be set to “myValue2”.

Hope this helps,
Thomas

Thanks Thomas for the inputs.
But I am not able to run the same.
I tested it in my Live Prieview but it gave error as the “View not found” error exception.

One thing which I want to know is what do you mean by “alias name”.
Is is the same name that of when we create a portlet or we need to mention the same somewhere else.

Thanks Thomas for the inputs.
But I am not able to run the same.
I tested it in my Live Prieview but it gave error as the “View not found” error exception.

One thing which I want to know is what do you mean by “alias name”.
Is is the same name that of when we create a portlet or we need to mention the same somewhere else.

Hmm, not sure about the error in the Live Preview… have you tried using the preview server or testing it directly on your MWS?

Regarding the alias I suggest that you have a look at the MWS documentation , the MWS Admin Guide explains what an alias is and how you set it up (“Managing Aliases” on page 190). Basically you can fefine an alias name for any page or portlet within MWS. This alias acts as a “shortcut” for accessing a server resource.

Hope this helps,
Thomas

Hi Thomas Stoesser,

I have implemented you approach same in tree toggle, to get URL parameters in another child tree portlet view i have done below code to get customer Number from URL Parametr in another portlet view but i could not get customer number in current view portlet, can you please help me how to achieve it .

ActionRequestImpl request= (ActionRequestImpl)this.getFacesContext().getExternalContext().getRequest();
HttpSession session =request.getSession();

	return request.getParameter("customerNumber");
  1. in one of the child tree node navigate to portlet in this view get the customer number in the logic., below is the URL

http://localhost:8585/portlet/partnermanagement___asksecurityquestions?wmp_rt=render&wmp_tc=%2Fportlet%2Fpartnermanagement___asksecurityquestions&wmp_tv=%2FAskSecurityQuestions%2Fdefault.view&customerNumber=3188877

  1. if i click another child node URL is look below, i need to get customer number in to the portlet page for that i writen above code by create customer number Data element in binding view but i am not getting customer number

http://localhost:8585/meta/default/csrefundrequest___refundrequest/0000032258?wmp10725.customerNumber=3188877&wmp9939.wmp_rt=render&wmp9939.wmp_tc=9939

can you please help me by giving scenario steps.

Regards,
Anil Kumar Ellendula

In your last example:

You’ll see that the param ‘customerNumber’ is prefixed with wmp10725. That signifies that this param is only for the portlet with the id 10725. If you want other portlets to be able to consume that customerNumber, you’ll need to modify the Portlet URL controls that you use to specify which other portlets should receive this param.

However, you might want to start using wiring instead. That would result in a less complicated URL created as well as only having to extract the param from the first portlet, and all other portlets could have their preferences taken directly through wiring and not custom code.

Regards,
–mark

Hi Mimel,

Thanks for reply, i have undrestand it is easy by doing wiring between two portlets views which is in same project, but my two differents portlets view are in two diffrent portlet projects how can i achieve wiring, i have tried with by creatingportlet preference in source portlet view added the customernumber filed in portlet preference in source and target portlet views, in the sysadmin MWS i went portlet-tartget project portlet view and in tools—>wiring in customerNumber selected other choosen source project portlet view but i am not able to see the customer number in the browse button, can you please help me to do wiring between two views which is in different projects.

Regards,
anil kumar ellendula

Hi Mimel,

I have done wiring like in source project portlet view tools—>wiring and selecetd Other and selected target project portlet view and clicked on browse button and selected the customerNumber in the preferences, but in ru-time customeNumber is not coming to the source portlet, to check this in source portlet i have mapped the customerNumber portlet prefernce binding expression to the value of text control.

the customer number is not displaying in the source text control.

can you please help me on this.

Regards,
Anil kumar Ellendula

Hi mimel,

I have sucessfully donw wiring i can able to get customerNumber.

thanks for help, i have done by choosing other option and selected the target portlet view and browse choosen customer number.

Regards,
Anil Kumar Ellendula