Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Omkar Khandare
How can i send custom parameter to another portlet on different page.
March 6, 2013 10:47 PM
Answer

Omkar Khandare

Rank: Junior Member

Posts: 40

Join Date: March 6, 2012

Recent Posts

I want to send my custom parameter to a different portlet from my current portlet's jsp page
using javascript.
How can i do that..??

I am passing my custom parameter to javascript function & appending to URL of calling page.
calling page have new portlet so its default doView() method get called.
but i am unable get my parameter i appended to URL.

through
request.getParameter("myParameter");

How it can achieved..??
plz help.
Juhi Kumari
RE: How can i send custom parameter to another portlet on different page.
March 6, 2013 11:27 PM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi Omkar,

Communication between two portlets can be done using IPC.
Check this link
and this wiki.

Regards
Juhi
Omkar Khandare
RE: How can i send custom parameter to another portlet on different page.
March 7, 2013 1:47 AM
Answer

Omkar Khandare

Rank: Junior Member

Posts: 40

Join Date: March 6, 2012

Recent Posts

If i want to Portlet Session to send parameter then..

How can i use Portlet session in javascript function
to set parameter using seAttribute() function of PortletSession.??
Juhi Kumari
RE: How can i send custom parameter to another portlet on different page.
March 7, 2013 5:01 AM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi,
You can't do it directly. Becouse session are controlled by server and
javascript runs client side.

Regards
Juhi
Jitendra Rajput
RE: How can i send custom parameter to another portlet on different page.
March 7, 2013 5:55 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 858

Join Date: January 7, 2011

Recent Posts

Try by using HttpRequest to get the parameter from URL.

HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(request);
httpRequest = PortalUtil.getOriginalServletRequest(httpRequest);
httpRequest.getParameter("myParameter");
Omkar Khandare
RE: How can i send custom parameter to another portlet on different page.
March 7, 2013 10:47 PM
Answer

Omkar Khandare

Rank: Junior Member

Posts: 40

Join Date: March 6, 2012

Recent Posts

Hi Jitendra,

It worked for me Thanks.
i am able to read url parameter using code given by You.

I have only added following two lines in liferay-portlet.xml file.

<private-request-attributes>true</private-request-attributes>
<private-session-attributes>false</private-session-attributes>

It doesn't work without these for me.

Thank You very much.
Jitendra Rajput
RE: How can i send custom parameter to another portlet on different page.
March 7, 2013 11:17 PM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 858

Join Date: January 7, 2011

Recent Posts

For private-request-attributes by default it is true only and you are setting and getting parameter from request so it should work even if don't set private-request-attributes to true.

<!--
Set the private-request-attributes value to true if the portlet does not share
request attributes with the portal or any other portlet. The default value is
true. The property "request.shared.attributes" in portal.properties specifies
which request attributes are shared even when the private-request-attributes
value is true.
-->
<!ELEMENT private-request-attributes (#PCDATA)>