4 Replies Latest reply on Sep 7, 2009 10:53 AM by yk

    Seam-Struts integration

    yk

      Hello,


      I'm working on a very huge struts project that needs to be migrated to seam 2x.


      The approach taken by the project chief is to mix struts (jsp for the old UI) and facelets (seam-facelets for the new UI) in the same view.
      Basically, we have a top, sidebar menu and a footer that should remain as struts pages fragments whereas the body is an iframe that references a facelets fragment.


      I wonder if it's the best approach and even is it possible to mix struts and facelets in the same web page ?


      thanks,

        • 1. Re: Seam-Struts integration
          asookazian

          I haven't used Struts with Seam projects but that approach sounds like a disaster waiting to happen.  How many existing pages are in that app?  Depending on the timeline and resources, you should highly consider refactoring the JSPs to Facelets/JSFs which is the recommended JEE 5 standard and what most Seam projects are using for the presentation/view layer these days.  If you can continue with your approach, you'll be mixing an action-based framework (Struts) with a component-based framework (JSF) and either way you really do not want to be using JSP.  The scriptlet coding becomes a nightmare as well as exception tracking (e.g. facelets in debug mode shows you the exact line number that caused the exception, not some seemingly random line number from a servlet).  Don't forget the templating features of Facelets (well, I guess you have Struts Tiles) and the fact that you don't need to pre-compile them to servlets like you do with JSPs or suffer a performance hit on the first access.


          Or maybe half the pages all Struts/JSP and the other half all Facelets/JSF if possible.  Not sure mixing both view technologies is possible or recommended on the same page (but I guess if you're using JSP and no xhtml it might work).


          I don't see a section covering Struts/Seam integration in the ref doc.


          From SiA:



          The SeamFilter can also wrap additional servlets such as Struts, Spring MVC, or DWR, allowing you to tap into
          the Seam container from these third-party frameworks as needed.

          There was no Struts integration coverage in SiA.


          Have you done a POC and discovered any integration issues?


          In any event, if you go with Facelets/JSF, it will be a major re-write of the presentation layer (minimally) because of all the JSF and possible RichFaces/ajax4jsf tags and action handlers in backing beans, etc. that will very likely be required.


          Remember, Seam is an integration framework that was designed to unify and extended JEE 5 (specifically JSF and EJB3) initially and now other presentation frameworks like Wicket and GWT and Flex are possibilities as well...

          • 2. Re: Seam-Struts integration
            yk

            I haven't used Struts with Seam projects but that approach sounds like a disaster waiting to happen


            I completely agree with you. Infact, I already suggested to rewrite the entire app using seam. But, unfortunately, I was told that we have no time to redo everything...


            thanks

            • 3. Re: Seam-Struts integration
              asookazian

              OTH, Spring 3 supports Struts integration with Web Flow:



              SWF integrates with existing frameworks like Spring MVC, Struts, and JSF, in both servlet and
              portlet environments. If you have a business process (or processes) that would benefit from a
              conversational model as opposed to a purely request model, then SWF may be the solution.

              JBoss/Seam is shooting themselves in the foot in this regard by basically forcing app rewrites to adopt Seam if Seam/Struts integration is not possible, I have not heard of Seam/Struts integration examples, etc....

              • 4. Re: Seam-Struts integration
                yk

                hi again,


                Is there any example of using seam together with struts please ?


                In a jsp I have some struts code and I'm trying to include a seam page (.xhtml) using jsp:include page=mypage.seam but it doesn't work properly.


                thanks