Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Davide .
portlet link to another one in another page
January 11, 2010 8:28 AM
Answer

Davide .

Rank: New Member

Posts: 5

Join Date: January 11, 2010

Recent Posts

Hello to all!

I'm trying to make a dinamic link into my portlet A that is in page 1 that go into a jsp in portlet B that is in page 2.

I'm only crazy or is possible?

i read a lot of thread but no find the solution.

anyone have it?

thanks
Rice Owl
RE: portlet link to another one in another page
January 11, 2010 11:13 AM
Answer

Rice Owl

Rank: Regular Member

Posts: 177

Join Date: April 23, 2009

Recent Posts

I've done this before two ways. One way is the use of URL parameters and the other way is the use of Sessions. Not sure if this will work in your situation, but it worked for me. I should note that this didn't do a form "post" to "Portlet B". Basically, the link in Portlet A would do a form post... then you can can sendRedirect(url) on the actionResponse object. This URL would be the URL of the page where Portlet B resides. If you are doing it via URL parameters, you'd of course update hte URL with those paramters. Then in Portlet B, in the doDispatch(..) method for instance, it would read those parameters and do the necessary work. If you are doing it via the Session, Portlet B would look for the variables in the session.

There may be other ways to do it, but those two ways have worked well for me. Portlet B can figure out which JSP it needs to load based on the parameters/session variables passed in.

Davide P:
Hello to all!

I'm trying to make a dinamic link into my portlet A that is in page 1 that go into a jsp in portlet B that is in page 2.

I'm only crazy or is possible?

i read a lot of thread but no find the solution.

anyone have it?

thanks
Davide .
RE: portlet link to another one in another page
January 12, 2010 1:08 AM
Answer

Davide .

Rank: New Member

Posts: 5

Join Date: January 11, 2010

Recent Posts

Hi Rice,

Firstable thanks for your reply!

My problem is another one...i mean that i don't know how to take the second page.

Now i can pass parameter using this code:

<a href=<liferay-portlet:renderURL portletName="PortletName_WAR_ApplicationName" ><portlet:param name="parameter" value="pippo" /></liferay-portlet:renderURL> > click me </a>

and all works fine in the same page, cause i know the name of the portlet B and i write it in liferay-tag.

I tryed to do a <a href=""> with the link of the other page ( for example )

<a href="http://localhost:8080/web/guest/page2?p_p_id=PortletName_WAR_ApplicationName&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-2&p_p_col_count=1&parameter=pippo"> click me 2 </a>

and work fine! in my portlet B in page 2 i have my parameter "pippo".

But i can't write the static link ...i have to build it dinamically taking "page 2".

Is it possible? write the link as the first? i have to indicate my page's name.
KK rajput
RE: portlet link to another one in another page
November 10, 2010 4:00 AM
Answer

KK rajput

Rank: Expert

Posts: 266

Join Date: April 10, 2008

Recent Posts

Hi Davide,
You need to know couple of things before using below method.
You need to have :
plid = layout id of the layout on which you want to render your request.
portletId = your portletId which portlet you want to invoke
struts_action = corresponding portlet struts path

e.g.
PortletURL portletURL = new PortletURLImpl(request, "[$portletId$]", [$plid$], portletRequest.RENDER_PHASE);
portletURL.setParameter("struts_action", "[$your_portlet_struts_path$]");
portletURL.setParameter("[$your_parameter_name$]", "[$your_parameter_value$]");

HTH
Kamal