Announcement Announcement Module
Collapse
No announcement yet.
Spring MVC with Tapestry [Solved] Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC with Tapestry [Solved]

    Hi.

    Foreword: I´m a Java and Spring beginner. And my ten years of Delphi and mod_perl programming experience doesn´t help very much.

    I want to use Jakarta Tapestry for a Spring MVC view and still be able to use other techs for Spring MVC views as well. (I want to output PDFs using Spring´s AbstractPdfView).

    I found the Tapestry-related chapter in the Spring reference. But the presented integration strategy seem to force a exlusive Tapestry use.

    Is there an alternative integration strategy?
    Does someone have some code samples how to use Spring MVC with both Tapestry and AbstractPdfView?
    Or any other hints?

    Thanks in advance.

  • #2
    Gert,

    There's nothing very exclusive about the Tapestry integration approach mentioned in the manual. I used that approach in an app to gradually move it over from being Struts-based to Tapestry based, and the app still has both Struts and Tapestry ui...

    What makes you think you can't mix and match? It's just a matter of partitioning your incoming request paths.

    Regards,

    Comment


    • #3
      I find the MyEngine implementation in the reference guide to be very generic and therefore reusable across multiple applications. Is there any chance that this class (with a name and package change, of course) could be rolled into Spring proper as a"standard" approach to Tapestry integration?

      Comment


      • #4
        It's a possibility. The only problem is that the integration point is so small at this point that it seems a shame to actually bring in a dependency on Tapestry into the framework just for that...

        Regards,

        Comment


        • #5
          Colin,

          Originally posted by Colin Sampaleanu
          What makes you think you can't mix and match?
          I have one servlet declared in my web.xml based on the
          Code:
          org.apache.tapestry.ApplicationServlet
          class.

          When I try some "partitioning" like this
          Code:
          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE web-app
          	PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
          	"http&#58;//java.sun.com/dtd/web-app_2_3.dtd">
          
          <web-app>
          
          	<display-name>FlexLayout</display-name>
          
              <filter>
                  <filter-name>redirect</filter-name>
                  <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
              </filter>
              <filter-mapping>
                  <filter-name>redirect</filter-name>
                  <url-pattern>/</url-pattern>
              </filter-mapping>
          
          	<servlet>
          		<servlet-name>flexlayout</servlet-name>
          		<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
          		<load-on-startup>1</load-on-startup>
          	</servlet>
          	<servlet-mapping>
          		<servlet-name>flexlayout</servlet-name>
          		<url-pattern>/app</url-pattern>
          	</servlet-mapping>
          
          	<servlet>
          		<servlet-name>flpdfpreview</servlet-name>
          		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
          		<load-on-startup>1</load-on-startup>
          	</servlet>
          	<servlet-mapping>
          		<servlet-name>flpdfpreview</servlet-name>
          		<url-pattern>/flpdfpreview</url-pattern>
          	</servlet-mapping>
          
          	<welcome-file-list>
          		<welcome-file>index.html</welcome-file>
          	</welcome-file-list>
          
          </web-app>
          the code can be valided any more. So I think I can have more than one servlet in one web app.

          Originally posted by Colin Sampaleanu
          It's just a matter of partitioning your incoming request paths.
          Could you explain that in detail? Give an example, please? I learn most from samples, but have not found one sophisticated Spring MVC with Tapestry source example.

          I support habuma´s request for a standard approach to Tapestry integration in the Spring framework like we have for FreeMarker and Velocity.

          Regards

          Comment


          • #6
            Gert,

            What do you mean by, "the code can be validated anymore"? It's perfectly valid to have multiple servlets defined in your web.xml file. One can be for Tapestry, and then multiple other servlets can be for Spring-MVC, Struts, whatver.

            FreeMarker and Velocity (and JSP) integration in Spring are fundamentally different than Tapestry integration. For the former, SpringMVC provides the controller logic, while FreeMarker/Velocity/JSP are just the view technology. When you talk about integrating Tapestry into Spring, it's about Tapestry being the entire view layer (no SpringMVC at all), or Tapestry running in parallel to SpringMVC. The connection between the two web ui frameworks in the latter case is simply via hyperlinks and the like between them. You can't use Tapestry as the view technology for SpringMVC, or use JSP as the view technology for Tapestry. That said, it's still a useful and valid approach to have both, and they can share the same application context definitions.

            Regards,

            Comment


            • #7
              Colin,

              Originally posted by Colin Sampaleanu
              What do you mean by, "the code can be validated anymore"?
              Should have read "the code can´t be validated anymore".

              In Eclipse 3 the XMLBuddy plugin give error messages like
              Code:
              The content of element type "web-app" must match "&#40;icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*&#41;".
              web.xml FlexLayout/context/WEB-INF	line 42
              Originally posted by Colin Sampaleanu
              FreeMarker and Velocity (and JSP) integration in Spring are fundamentally different than Tapestry integration. For the former, SpringMVC provides the controller logic, while FreeMarker/Velocity/JSP are just the view technology. When you talk about integrating Tapestry into Spring, it's about Tapestry being the entire view layer (no SpringMVC at all), or Tapestry running in parallel to SpringMVC. The connection between the two web ui frameworks in the latter case is simply via hyperlinks and the like between them. You can't use Tapestry as the view technology for SpringMVC, or use JSP as the view technology for Tapestry. That said, it's still a useful and valid approach to have both, and they can share the same application context definitions.
              That helped me to understand the fundamental difference between SpringMVC + FreeMarker/JSP/Velocity and Spring + Tapestry. Sould be made more clear in the docs.

              May I habe a look at a sample web.xml?

              Regards.

              Comment


              • #8
                Gert,

                You just need to keep your sevlet and servlet-mapping declarations (along with all the other elements) in the right order, as listed in the DTD. The parser is simply complaining about that. Just take a look at the DTD, it should be very simple to order things properly (in fact the order is given in the error message too).

                Aside from that, your web.xm file is fine...

                Regards,

                Comment


                • #9
                  Originally posted by GertThiel
                  In Eclipse 3 the XMLBuddy plugin give error messages like
                  Code:
                  The content of element type "web-app" must match "&#40;icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*&#41;".
                  web.xml FlexLayout/context/WEB-INF	line 42
                  Forget the validation stuff. I reordered the web.xml content and that helped. My fault :?

                  Regards.

                  {I submitted this post in parallel with Colin´s post. Multitasking and sync mismatch :wink:}.

                  Comment


                  • #10
                    Colin,

                    Originally posted by Colin Sampaleanu
                    It's just a matter of partitioning your incoming request paths.
                    I think, I´m still in trouble with that partitioning stuff. I created a new topic (Need help with SpringMVC and PDF) regarding that.

                    You´re my brightest hope for help .

                    Regards.
                    Last edited by Rod Johnson; Jan 18th, 2006, 10:08 AM.

                    Comment


                    • #11
                      Spring MVC with Tapestry [Solved]

                      http://forum.springframework.org/showthread.php?t=9664. Thanks and regards.
                      Last edited by robyn; May 14th, 2006, 04:54 PM.

                      Comment

                      Working...
                      X