掲示板

how to use then one java class as a portlet-class

11年前 に harish chandra maurya によって更新されました。

how to use then one java class as a portlet-class

New Member 投稿: 2 参加年月日: 12/10/24 最新の投稿
Hi

I am new to liferay developement .I am trying to creating MVC portlet , with more then one jsp, now i want to use per java class for per jsp for action and render , how can i use . for portlet.xml i can move to and jsp Example view.jsp ... and from there i can save thing to database using portlet-class, after that i want to move to other jsp that can be done by using render action now for 2nd jsp i want to save other values to database.... now i want to use another java class or portlet-class how i do the mapping .

Can any one help me on that

Thanks

添付ファイル:

thumbnail
11年前 に Jignesh Vachhani によって更新されました。

RE: how to use then one java class as a portlet-class

Liferay Master 投稿: 803 参加年月日: 08/03/10 最新の投稿
Harish,

Ideally controller will be unique for MVC structure i think. So you can definitely call different methods from different classes in controller class it self and can achieve your requirement.
Or else you can use struts portlet which can call different action classes as per the struts action URL.
thumbnail
11年前 に Gnaniyar Zubair によって更新されました。

RE: how to use then one java class as a portlet-class

Liferay Master 投稿: 722 参加年月日: 07/12/19 最新の投稿
A portlet can have only one portlet class which you have configured in portlet.xml. Based on your RENDER or ACTION URL, you process or render action will be triggered .

ACTIONURL
=========
<liferay-portlet:actionurl name="addMethod"></liferay-portlet:actionurl> , this url will trigger you action method from your portlet class....

public class TestPortlet extends MVCPortlet {

public void addMethod(ActionRequest actionRequest,
			ActionResponse actionResponse) throws IOException, PortletException {
      // logic goes here
}
}

Like that, you can have "N" number action method in your portlet class.

RENDERURL:
===========

<liferay-portlet:renderurl var="testRenderURL">
	<liferay-portlet:param name="jspPage" value="/html/portlet/test/test.jsp" />
</liferay-portlet:renderurl>

<a href="<%=testRenderURL.toString()%>"></a> Go to test page 


if you mention "jspPage" parameter with your render URL, it will directly go to that particular jsp file through doView/render method of your portlet class.

if you dont mention "jspPage" parameter with renderURL, then you have to redirect to jsp file from doView/render method .

HTH

- Gnaniyar Zubair
11年前 に harish chandra maurya によって更新されました。

RE: how to use then one java class as a portlet-class

New Member 投稿: 2 参加年月日: 12/10/24 最新の投稿
Thanks,for the fruit full answer
10年前 に Seeya S Kudtarker によって更新されました。

RE: how to use then one java class as a portlet-class

Regular Member 投稿: 187 参加年月日: 13/01/16 最新の投稿
Sorry for interupting the post.
I have a similar query.

I have my portlet class in package com.test.portal. I have included two more classes in it, say a.java and b.java just to make my code clean by including similar functions in one class.

How should I access the functions from a.java or b.java since whenver we specify action in form, it goes to the Action class?