论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Omkar Khandare
How can i send custom parameter to another portlet on different page.
2013年3月6日 下午10:47
答复

Omkar Khandare

等级: Junior Member

帖子: 40

加入日期: 2012年3月6日

最近的帖子

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.
2013年3月6日 下午11:27
答复

Juhi Kumari

等级: Expert

帖子: 347

加入日期: 2011年12月12日

最近的帖子

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.
2013年3月7日 上午1:47
答复

Omkar Khandare

等级: Junior Member

帖子: 40

加入日期: 2012年3月6日

最近的帖子

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.
2013年3月7日 上午5:01
答复

Juhi Kumari

等级: Expert

帖子: 347

加入日期: 2011年12月12日

最近的帖子

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.
2013年3月7日 上午5:55
答复

Jitendra Rajput

等级: Liferay Master

帖子: 858

加入日期: 2011年1月7日

最近的帖子

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.
2013年3月7日 下午10:47
答复

Omkar Khandare

等级: Junior Member

帖子: 40

加入日期: 2012年3月6日

最近的帖子

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.
2013年3月7日 下午11:17
答复

Jitendra Rajput

等级: Liferay Master

帖子: 858

加入日期: 2011年1月7日

最近的帖子

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)>