GateIn 3.2 ignores actionURL parameters

919 Views Asked by At

I'm using GateIn 3.2.0.FINAL with Tomcat 7 (GateIn-3.2.0.Final-tomcat7.zip). It looks like the parameters in the actionURL are ignored.

My controller looks like this:

@ActionMapping("search")
public void search(ActionRequest request) {
    LOG.info("doing search");
}

@ActionMapping("save")
public void save(ActionRequest request) {
    LOG.info("doing save");
}

My JSP looks like this:

<portlet:actionURL var="saveURL">
    <portlet:param name="javax.portlet.action" value="save"/>
</portlet:actionURL>

<form:form id="${ns}-save" action="${saveURL}" modelAttribute="createModel">
    <!-- omitted some html -->
    <input type="submit" value="submit"/>
</form:form>

When I press the submit button, the POST should include a javax.portlet.action=save, but it doesn't. No parameter named javax.portlet.action is included, and an exception is thrown because no matching @ActionMapping method can be found.

The URL generated for the form tag in the HTML looks like this:

/portal/classic/home/Permissions?navigationalstate=<gibberish>&amp;portal:componentId=<an UUID>&amp;interactionstate=<gibberish>&amp;portal:type=action&amp;portal:isSecure=false

If I manually edit the URL with firebug and add &javax.portlet.action=save to it, it works like a charm and it finds the save() method in the controller.

Now, if I deploy the exact same war in jBoss Portal 2.7.2, &javax.portlet.action=save is included in the URL. The same is true for GateIn 3.1.0.FINAL with Tomcat 6.

PS

I've also tried with another parameter key:

@ActionMapping({params = "myparam=save"})
public void save(ActionRequest request) {
    LOG.info("doing save");
}

...and:

<portlet:actionURL var="saveURL">
    <portlet:param name="myparam" value="save"/>
</portlet:actionURL>

...with the same results. Works find in GateIn 3.1 and jBoss Portal 2.7.2, but not GateIn 3.2.

It also does not work with GateIn 3.2.0.FINAL with Tomcat 6.

EDIT

Forgot to mention that doing this works, but I'd prefer not to use it:

<form:form id="${ns}-save" action="${saveURL}&javax.portlet.action=save" modelAttribute="createModel">
   <!-- omitted -->
</form:form>
2

There are 2 best solutions below

1
On

Try setting escapeXML="false" on actionURL.

1
On

Try this

ActionMapping({params = "action=save"})
public void save(ActionRequest request) { 
    LOG.info("doing save"); 
}

and

<portlet:actionURL var="saveURL" escapeXml="false">
    <portlet:param name="action" value="save"/>
</portlet:actionURL>

action is default param name and you must do other changes to use your own.