掲示板

Liferay Spring MVC : How to call controller from another controller

10年前 に Ketan Patel によって更新されました。

Liferay Spring MVC : How to call controller from another controller

Junior Member 投稿: 72 参加年月日: 12/05/04 最新の投稿
Hello All,

I'm currently using spring MVC for my project.

How can I call a controller class of one portlet to controller class of another portlet in spring mvc portlet.

Please help me.

Thanks in Advance.. emoticon
thumbnail
10年前 に Manish Yadav によって更新されました。

RE: Liferay Spring MVC : How to call controller from another controller

Expert 投稿: 493 参加年月日: 12/05/26 最新の投稿
Ketan Patel:
Hello All,

I'm currently using spring MVC for my project.

How can I call a controller class of one portlet to controller class of another portlet in spring mvc portlet.

Please help me.

Thanks in Advance.. emoticon


For above scenario you have to use IPC concept.Check Below Link
http://www.liferay.com/community/wiki/-/wiki/Main/Portlet+to+Portlet+Communication?_36_pageResourcePrimKey=6629472



Thanks & Regards
Manish Banwari lal Yadav
10年前 に Ketan Patel によって更新されました。

RE: Liferay Spring MVC : How to call controller from another controller

Junior Member 投稿: 72 参加年月日: 12/05/04 最新の投稿
Hello Manish,

Thanks for your reply.

Just to add more on my question.

I want to call a controller class from second portlet's controller class of @RenderMapping() method.
thumbnail
10年前 に Sandip Patel によって更新されました。

RE: Liferay Spring MVC : How to call controller from another controller

Regular Member 投稿: 205 参加年月日: 11/01/05 最新の投稿
Hi Ketan,

You can create Action URL of other portlet B in Portlet A Render method as below.

create Action Url in Portlet A render mathod.

PortletURL myUrl = PortletURLFactoryUtil.create( request, Portlet B Id,Page ID where Portlet B Extist, PortletRequest.ACTION_PHASE);
myURL.set();
And use this URL where to use.. This URL will redirect you to other portlet B's Action Method.
10年前 に Ketan Patel によって更新されました。

RE: Liferay Spring MVC : How to call controller from another controller

Junior Member 投稿: 72 参加年月日: 12/05/04 最新の投稿
Hello Sandip.

It's help me. I have done it same as you said.

Thanks a lot.

--
Ketan
8年前 に Hussain Shaikh によって更新されました。

RE: Liferay Spring MVC : How to call controller from another controller

Junior Member 投稿: 44 参加年月日: 12/06/07 最新の投稿
Hi Sandip,
I am working with Liferay Spring frame work,


<%
PortletURL myUrl = PortletURLFactoryUtil.create( request,"PortletID-portlet",1234, "RENDER_PHASE");
myUrl.setParameter("test", "asif");
%>
<%= myUrl %>

the url generated is
http://localhost:8080/web/site/pagename?p_p_id=PortletID-portlet&p_p_lifecycle=0&p_p_col_id=column-1&p_p_col_count=1&_PortletID-portlet_test=asif

but when i hit this url, I am unable to get value of 'test' in the controller
Can u help me getting value of 'test' in controller?

Thanks in advance
8年前 に Govinda N によって更新されました。

RE: Liferay Spring MVC : How to call controller from another controller

Junior Member 投稿: 28 参加年月日: 14/04/02 最新の投稿
Hi Hussain,

<%
PortletURL myUrl = PortletURLFactoryUtil.create( request,"PortletID-portlet",1234, "RENDER_PHASE");
myUrl.setParameter("test", "asif");
%>


Check the portlet name("PortletID-portlet") you are giving is correct or not because it should be in the form of <portlet_id>_WAR_<portlet_project_name>

e.g.
portlet id: my-portlet
project name: my-portlet-project
then the name you should pass in PortletURLFactoryUtil.create() method should be "myportlet_WAR_myportletproject"