Thursday, November 10, 2016

Creation of Portlet URL in Java

We  already know how to create Liferay URL in jsp file.Today we will discuss how to Create Portlet URLs in Java file or in we can say in Controller . Here we create a simple actionURL in our doview method and than call processAction by using it.So lets start this step by step:-

Step 1:-Create Liferay Project and Portlet 
Just create a project and then create a portlet in it. 

Step 2:-Change your Controller 
Just open your java file and paste this:-

Focus on line 22 - 24 here we create a ActionURL and set a parameter with name as key and Liferay is Easy as value. Finally we put this URL in request.

Step 3:-Change your view.jsp
Now open your view.jsp and paste this:-


1)Here we use useBean tag to retrieve the ActionURL from request and place in variable called myActionURL.
2)Then we create a link ,on click of this link processAction method is Called.

Step 4:-Check the Output
Now deploy the portlet and click on  Click Here For ActionURL:-

when we click the link , processAction method inside the controller is called where we fetch the value of parameter which we set in our actionURL (see in step 2).

You can Download Source code from  Creation of PortletURL in java. 

Hope this will Help....

Related Post:-

No comments:

Post a Comment

Total Pageviews

Number Of Unique Visitor

Free counters!