0

I'm using Spring MVC portlets I need to implement one display tag with external pagination. In order to do this, I've defined my table in the JSP like this:

    <portlet:actionURL var="viewListURL">
        <portlet:param name='action' value='${ServletContextKeys.MY_ACTION_METHOD}'/> 
    </portlet:actionURL>  
                <display:table name="${whateverList}"
                               requestURI="${viewListURL}"
                               class="displayTagTable"
                               export="true"
                               uid="item"
                               pagesize="10"
                               partialList="true"
                               sort="external"
                               defaultsort="1"                                  
                               size="${ServletContextKeys.SC_LIST_SIZE}">
     ...

The problem is that, when I click any button to paginate, the displaytag redirects me to the render phase instead the action phase as I want to. What am I doing wrong? Any ideas..? Thanks a lot

EDIT: I can see in the URL that the parameter p_p_url_type=0 (render phase). it makes no sense to me, as I'm calling an action url, but maybe would be enough just change this parameter to p_p_url_type=1. But, I'm just don't know how... Any ideas?

http://localhost:8080/wsdes/user/sifo3/home?p_p_id=SifoIIIweb_WAR_sifo3economicoweb_INSTANCE_s8jH&p_p_lifecycle=1&p_p_url_type=0&p_p_state=maximized&p_p_mode=view&_SifoIIIweb_WAR_sifo3economicoweb_INSTANCE_s8jH_action=consultaJustificantes&_SifoIIIweb_WAR_sifo3economicoweb_INSTANCE_s8jH_implicitModel=true&_SifoIIIweb_WAR_sifo3economicoweb_INSTANCE_s8jH_d-49489-p=2
elcadro
  • 1,482
  • 3
  • 21
  • 45
  • I can see in the URL that the parameter p_p_url_type=0 (render phase), so maybe would be enough just change this parameter to p_p_url_type=1. The only thing now is how..? – elcadro Jan 16 '13 at 10:13
  • This may help to find the solution: a common problem that occurs with Displaytag + Spring is that onSubmit is (by default) only called on POST requests. Keep in mind that displaytag uses GET requests for sorting and pagination (as it should), so you may have to play with overriding the isFormSubmission method in your controller, if you want to handle sorting and pagination in onSubmit – elcadro Jan 17 '13 at 08:49

2 Answers2

0

Been there before. I solved the problem in a different way, but while looking in DisplayTag source code I found some interesting things. For example, in PortletHref you can find this in the addParameter method:

     if (PARAM_TYPE.equals(name))
        {
           if (TYPE_RENDER.equals(value))
           {
               this.setAction(false);
           }
           else if (TYPE_ACTION.equals(value))
           {
              this.setAction(true);
           }

And also:

 private static final String PARAM_PREFIX = "portlet:";
 public static final String PARAM_TYPE = PARAM_PREFIX + "type";
 public static final String TYPE_ACTION = "action";

Apparently, if you need a parameter named portlet:type with value action to make DisplayTag generate an Action URL. I haven't tested myself, so let me know if it works.

Carlos Gavidia-Calderon
  • 7,145
  • 9
  • 34
  • 59
  • I understand what you mean, but I'm not sure how to do it. Could you please post a snippet to help me? – elcadro Jan 16 '13 at 09:48
  • I can see in the URL that the parameter p_p_url_type=0 (so, it goes to the render phase), so maybe would be enough just change this parameter to p_p_url_type=1 (action phase). The only thing now is how..? – elcadro Jan 16 '13 at 12:38
0

I still don't know the reason, but I fixed this issue changing the display tag for Portlets (displaytag-portlet.jar), to the standard displaytag, and deleting from the displaytag.properties file the factory.requestHelper property: factory.requestHelper=org.displaytag.portlet.PortletRequestHelperFactory

Using the normal displaytag library, instead of the portlet one, fixed my problems.

elcadro
  • 1,482
  • 3
  • 21
  • 45