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 .

Rate Me:

6 Discussion:

Gnaniyar @ நிலவு நண்பன் said...

You should give 5$ to me... :)

Jignesh Vachhani said...

Sure Gnaniyar,

As I launched this rewards from today itself. So from now if you think you have any specific solutions or any specific that is worthy and really helpful to any other members, please pass it across us we will publish and provide you rewards from now for sure :)


Monu Sonu said...

Can you please help me
http://www.liferay.com/community/forums/-/message_boards/message/22776925

Thanks

shri kant said...

Nice one..

shri kant said...

Nice one.. :)

shri kant said...

Nice one.. :)