Thursday, November 2, 2017

Multiple ActionURL Call on Click of Buttons in Liferay

We already know how to submit a form in Liferay. Normally we create a Form with a submit button and in Form action we pass actionURL .

When we click the submit button the form is submitted and call the process action method. But sometimes we need to call various action methods on clicking of simple buttons. So today we will discuss this in detail.

So lets start this Step by Step:-

Step 1:-Create a project and portlet
Create a project and then create a portlet in it .Here my project name is multisubmit-portlet and portlet name is Demo.

Step 2:-Change the jsp
Change your view.jsp as:-


1)In the view.jsp first we create two actionURLs (firstURL and SecondURL).
2)Then we create two aui buttons and handle the click event by using aui.
3)${message} is shown when we click on a button . This message is set in our controller.
4)Here we use c tag so add the jstl jars in

Step 3:-Change the Controller
Now change your

1)Here we handle the request when first button is clicked first method is called and when second button is clicked second method is called.
2)Here we also set the message in request that can be used on our jsp.

Step 4:-Check the Output
Now deploy the portlet and check the output:-

When we click on First:-

When we click on second

No comments:

Post a Comment

Total Pageviews

Number Of Unique Visitor

Free counters!