29 January, 2013

How actionurl and renderurl works ?

If you are beginner and not much familiar with the action URL and render URL, Here is the information.

Liferay portlet will have only one portlet controller class which you might have already configured in portlet.xml. Based on your render url 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
}
}
Here you can have "N" number action method in your portlet class.
So you can call as per your requirement and condition.

renderURL:

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

<a href="<%=testRenderURL.toString()%>" /> Go To </a>

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 don't mention "jspPage" parameter with renderURL, then you have to redirect to jsp file from doView/render method .

Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...