Liferay <portlet:actionURL>

Seeya K picture Seeya K · Mar 11, 2013 · Viewed 25.4k times · Source

In my jsp I have the following code:

<portlet:actionURL name="addDetails" var="addDetailsURL" />
<aui:form name="addDetails" action="<%=addDetailsURL.toString() %>" method="post" >
        <aui:input type="text" label="name:" name="name" value="" />
        <aui:input type="text" label="surname:" name="surname" value="" />
        <aui:input type="text" label="age:" name="age" value="" />
        <aui:button type="submit" value="addDetails" />
</aui:form>

I am using liferay. I want to submit this data which will be processed in a java class. my java class has few functions. how should I specify in the above jsp that it should access the particular function in java after submitting the form?

Answer

perp picture perp · Mar 11, 2013

If your portlet inherits MVCPortlet, simply create a public method with the same "name" as your actionURL, that takes an ActionRequest and ActionResponse argument:

public void addDetails(ActionRequest req, ActionResponse rsp) {
    // ...
}