Announcement Announcement Module
Collapse
No announcement yet.
MVC TilesConfigurer for Tiles 2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MVC TilesConfigurer for Tiles 2

    Hey,

    I'm introducing Spring 2 to a new project and trying to reuse the substantial Tiles 2 definitions I've inherited from a non-MVC driven site.
    Been using Tiles 2.0.3 Snapshot so far - yep - 'Snapshot' (please don't ask)!

    Anyway, first hurdle: Spring MVC's TilesConfigurer is still referring to Struts's Tiles 1 packages (org.apache.struts.tiles).
    Fair enough I figure. Tiles 2 doesn't have it's own release out of the sandbox.

    Though I'd started writing a Tiles2Configurer, I assumed the attempt has already been made.

    Have you come across any attempt to gracefully tie in Tiles 2 with Spring 2 in a successful way?

    Thanks a lot

  • #2
    MVC TilesConfigurer for Tiles 2

    Hi,

    I am facing the same problem.


    georgea

    Comment


    • #3
      I can't see anything in JIRA. Why not raise an issue and see what comes back?

      Comment


      • #4
        Thanks Dave - raised JIRA ticket as suggested

        http://opensource.atlassian.com/proj...browse/SWF-315

        Comment


        • #5
          TilesConfigurer

          Has anyone written a TilesConfigurer / TilesView that works with apache's latest version?

          I hope this gets pushed to one of the Spring 2.1 releases...

          Comment


          • #6
            update

            I was able to get some results using the following:

            web.xml:
            Code:
            <listener>
            		<listener-class>org.apache.tiles.web.startup.TilesListener</listener-class>
            	</listener>
            
            	<context-param>
            		<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
            		<param-value>/WEB-INF/tiles-defs.xml,/WEB-INF/tiles-defs2.xml,/org/apache/tiles/classpath-defs.xml</param-value>
            	</context-param>
            new class "Tiles2View":
            Code:
            package com.yourcompany;
            
            import java.util.Map;
            
            import javax.servlet.http.HttpServletRequest;
            import javax.servlet.http.HttpServletResponse;
            
            import org.apache.tiles.TilesContainer;
            import org.apache.tiles.access.TilesAccess;
            import org.springframework.web.servlet.view.AbstractUrlBasedView;
            
            public class Tiles2View extends AbstractUrlBasedView {
            
            	@SuppressWarnings("unchecked")
            	@Override
            	protected void renderMergedOutputModel(Map model, HttpServletRequest request,
            			HttpServletResponse response) throws Exception {
            		TilesContainer container = TilesAccess.getContainer(request.getSession().getServletContext());
            		exposeModelAsRequestAttributes(model, request);
            		container.render(getUrl(), request, response);
            	}
            }
            views.properties (at the root of the classpath):
            Code:
            your-view-name.(class)=com.yourcompany.Tiles2View
            your-view-name.url=.tiles-view-definition-name

            Comment


            • #7
              Tiles2Configurer - JIRA open - Struts in the meantime

              Good Job George on raising the JIRA.

              I checked it again at http://opensource.atlassian.com/proj...rowse/SPR-3535 and I see that Juergen is considering it for release in 2.2, maybe even 2.1!

              Sadly, in the meantime (+ other factors), I've moved on to integrating Tiles 2.0.4 with Struts 2.0.8 instead - with Spring 2.0.6 as IoC (so far).
              I know, I know I wanted to go Spring all the way but I hadn't given Struts 2 (ex WebWork) a good chance yet!

              Maven is pretty much up to date on the plugins (Tiles+Struts & Struts+Spring).

              In passing trekmbikes, good effort, though personally I use URL XML mapping.

              Thanks all.

              Comment


              • #8
                Hey all,

                Has anyone got this working yet? I need this going ASAP but seem to be having issues.

                I think it may be related to the preparer stuff now required.

                java.lang.NullPointerException
                at org.apache.tiles.servlet.context.ServletTilesReque stContext.forward(ServletTilesRequestContext.java: 198)
                at org.apache.tiles.servlet.context.ServletTilesReque stContext.dispatch(ServletTilesRequestContext.java :185)
                at org.apache.tiles.impl.BasicTilesContainer.render(B asicTilesContainer.java:417)
                at org.apache.tiles.impl.BasicTilesContainer.render(B asicTilesContainer.java:368)
                at org.springframework.web.servlet.view.tiles2.TilesV iew.renderMergedOutputModel(TilesView.java:63)

                Any help would be greatly appreciated!

                Comment


                • #9
                  hi all,

                  mybe this will help you:

                  http://forum.springframework.org/showthread.php?t=42671

                  greez,

                  dialsc

                  Comment


                  • #10
                    Hello,

                    In the above example posted by "trekmbikes",

                    If we use TilesAccess.getContainer(getServletContext()) instead of TilesAccess.getContainer(request.getSession().getS ervletContext()) will it cause any issues? We don't want to create the session (and the JSESSIONID cookie) in our application.

                    Thanks much.

                    Comment

                    Working...
                    X