Wednesday, May 30, 2012

grails portlet plugin actionView not invoked


I was using the Grails plugin for creating Portlets found here:

I created the Portlet code by invoking the following command: 
grails create-portlet MyFirst

This automatically created the Portlet class which contains the following code snippet:

    def actionView = {
        //TODO Define action phase for 'view' portlet mode
        portletResponse.setRenderParameter("prp-1", "value-1");

The following the instructions as documented, I invoke the following command to generate the view for the portlet:

grails generate-portlet-views
It creates several files with one of them being the view.gsp file. This file has a snippet as shown:

<form action="${portletResponse.createActionURL()}">
    <input type="submit" value="Submit"/>

The trouble was, when I goto submit the form, the actionView method never gets invoked. Only the renderView method get's invoked:


The problem was that the form did not declare a POST method. I modified the view.gsp as follows:

<form action="${portletResponse.createActionURL()}" method="post">
    <input type="submit" value="Submit"/>



No comments:

Post a Comment