Using SiteMesh with RequestDispatcher's forward()

前端 未结 1 1412
萌比男神i
萌比男神i 2021-01-13 04:02

I\'m attempting to integrate SiteMesh into a legacy application using Tomcat 5 as my a container. I have a main.jsp that I\'m decorating with a simple decorator

1条回答
  •  礼貌的吻别
    2021-01-13 04:09

    My understanding is that SiteMesh is integrated into the application as a Servlet filter. By default, servlet filters are only invoked against the original incoming request (in your case, the request to the servlet). Subsequent forward or include requests are not passed throuh the filter, and therefore will not be passed through sitemesh.

    You can, however, instruct the filter to be invoked on forwards, using something like this:

    
        sitemesh
        MyServlet
        FORWARD
    
    

    Which instructs the container to only operate on FORWARD requests. The other options are INCLUDE and REQUEST, you can have several elements.

    So your options are to either change your filter config to specify FORWARD, or to change your filter-mapping to match the servlet path, rather than the JSP path. Either one should work.

    0 讨论(0)
提交回复
热议问题