is there a way to get Spring MVC forms namespaced for portlets? I don't want to set
<requires-namespaced-parameters>false</requires-namespaced-parameters>
in order to get spring mvc forms working under Liferay 6.2.
I was thinking of overriding the Spring form-taglib so that it puts the portlet-namespace prefix in front of the form field names/ids without actually trying to bind them to bean-properties with a namespace (which will obviously not work) but that seems very time-consuming.
Does anybody know of another way to solve this problem?
Here is an example of a form to show the exact problem:
<portlet:actionURL var="actionURL">
<portlet:param name="action" value="search"/>
</portlet:actionURL>
<form:form action="${actionURL}" commandName="searchSettings">
<form:input path="textField"/>
<form:input path="anotherTextField"/>
<input type="submit" value="Search"/>
</form:form>
And its corresponding bean would be:
public class SearchSettings {
private String textField;
private String anotherTextField;
// .. getters & setters
}
This will not work under Liferay 6.2 as the form inputs are not namespaced. They should be namespaced like so:
<c:set var="ns"><portlet:namespace/></c:set>
<form:input path="${ns}textField"/>
However this will not work since now Spring will try to bind the formfield to a property
SearchSettings._namespace_portlet_textField
which of course does not exist.
Has anybody come across this problem and found a solution other than override Spring MVCs Form-Taglib? I saw that it's already documented on Spring's JIRA (https://jira.springsource.org/browse/SPR-11176) but I couldn't find much else on it.
Thanks in advance.