Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Spring MVC with Tapestry [Solved]

  1. #1
    Join Date
    Aug 2004
    Location
    Essen, Germany
    Posts
    11

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    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,

  3. #3
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    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?

  4. #4
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    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,
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  5. #5
    Join Date
    Aug 2004
    Location
    Essen, Germany
    Posts
    11

    Default

    Colin,

    Quote 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.

    Quote 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

  6. #6
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    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,
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  7. #7
    Join Date
    Aug 2004
    Location
    Essen, Germany
    Posts
    11

    Default

    Colin,

    Quote 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
    Quote 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.

  8. #8
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    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,
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  9. #9
    Join Date
    Aug 2004
    Location
    Essen, Germany
    Posts
    11

    Default

    Quote 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:}.

  10. #10
    Join Date
    Aug 2004
    Location
    Essen, Germany
    Posts
    11

    Default

    Colin,

    Quote 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 at 10:08 AM.

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. Replies: 5
    Last Post: Aug 9th, 2008, 05:30 AM
  3. Spring Web Flow + Spring Framewrk + Tapestry.
    By cspangen in forum Web Flow
    Replies: 1
    Last Post: Oct 14th, 2005, 02:39 AM
  4. A Spring Class Loader?
    By azzoti in forum Architecture
    Replies: 8
    Last Post: May 7th, 2005, 04:02 AM
  5. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •