I have a liferay portlet with a simple form for entering two numbers and submitting them to be added:
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<portlet:defineObjects />
<portlet:actionURL var="calculateURL">
<portlet:param name="mvcPath" value="/html/calculator/edit.jsp" />
</portlet:actionURL>
<aui:form action="<%= calculateURL %>" method="post">
<aui:input label="x" name="x" type="text" value="${x}"/>
<aui:input label="y" name="y" type="text" value="${y}"/>
<aui:button type="submit" value="add"/>
</aui:form>
This works fine. I would now like to add a button that allowed me to subtract the numbers instead. But when I add the new button, I don't know how to differentiate between which button was pressed, when I am in my processAction method. How can I do this?
Alternatively: I have found this answer on how to do it, but I wasn't able to get it to work. Does it point me in the right direction, and should I keep experimenting with the answer given there?