RE: Re: [Liferay Forums][3. Development] Pass parameters to a portlet confi

468975, modified 17 Years ago. New Member Posts: 20 Join Date: 2/10/08 Recent Posts
Hi all.

portal Until Liferay version 4.4.2 I was able to pass parameter to a portlet configured in a page using the instance name.
For instance if I wanted to pass the articleId 10130 to the JournalContent portlet I needed just to add in the URL _56_INSTANCE_tes1_articleId=10130, considering that in this particular case the instance name was 56_INSTANCE_tes1.
I am trying to update to liferay portal 5.1.0 but I am not able to use this approach any more.

Can you help me?

Best regards.
thumbnail
10527, modified 17 Years ago. Liferay Legend Posts: 1197 Join Date: 2/8/05 Recent Posts
On Tue, 2008-09-09 at 13:22 +0000, Mario Striglione at Liferay's
Community Forums wrote:

> I am trying to update to liferay portal 5.1.0 but I am not able to use
> this approach any more.


It's because according to the JSR-286 spec, it is illegal to pass a
parameter to a portlet when you are not directly targeting the portlet,
which means you have to include the p_p_lifecycle and p_p_id params
along with the namespaced param.

This ends up looking like:

[tt]p_p_lifecycle=0&p_p_id=56_INSTANCE_tes1&_56_INSTANCE_tes1_articleId=10130[/tt]

which is kinda ugly and heavy.

SO, use the friendly URL instead:

[tt]<layoutFriendlyURL>/-/journal_content/<groupId>/56_INSTANCE_tes1/10130[/tt]
468975, modified 17 Years ago. New Member Posts: 20 Join Date: 2/10/08 Recent Posts
Hi!

Thanks for the answer.

But what if I need to pass parameters to two different instances of two different portlets? In this way I can refer only to one instance of one portlet.

Best regards.
3096079, modified 16 Years ago. New Member Posts: 3 Join Date: 5/14/09 Recent Posts
Hi.

I'm developing a portal in Liferay for our company.

And we need to render one page with few portlets, but all of these portlets need to get the same parameter at a time.
Getting a parameter from page request seams to be best solution for this.

Is it possible? Or is there another way to do this?

Best regards.
3096079, modified 16 Years ago. New Member Posts: 3 Join Date: 5/14/09 Recent Posts
I figured it out, by using JSR-286 public render parameter in portlet.xml

(example for jsf: http://blogs.sun.com/deepakg/entry/jsf_portlet_and_public_render)

Maybe someone will find it useful.