PDA

View Full Version : spring portlet mvc and form tag


pbsr
Jun 3rd, 2006, 04:47 AM
When I am defining a HTML form tag in portal environment we use something like

<form method="post" action="<portlet:actionURL/>">

How can define something similar using spring form tag.

Mark Fisher
Jun 3rd, 2006, 09:35 AM
The <portlet:actionURL/> element provides a "var" attribute. This allows you to set parameters for the actionURL (even with evaluation of a variable in a <jsp:attribute/> tag if necessary) and assign the resulting var to the Spring form tag's action attribute, like so:

<portlet:actionURL var="formAction">
<portlet:param name="action" value="addPet"/>
<portlet:param name="_page"><jsp:attribute name="value"><c:out value="${page}"/></jsp:attribute></portlet:param>
</portlet:actionURL>

<form:form commandName="pet" method="post" action="${formAction}">
...
</form:form>

pbsr
Jun 3rd, 2006, 09:56 AM
thank you.. Works great.