Announcement Announcement Module
No announcement yet.
Spring MVC vs. Struts 2 (WebWork 2) Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC vs. Struts 2 (WebWork 2)

    We are currently evaluating various MVC frameworks. The main candidates are Spring MVC and Struts 2 (based on WebWork 2).

    In most of the key features compared, Spring MVC and WebWork 2 are equally good, except in the UI supports. It seems to me Spring MVC just provides tags for basic HTML form tags while WebWork 2 provides many out-of-box JSF-styled complex and composite tags, such as:
    • WebWork 2 integrates with Dojo AJAX framework closely and provides many complex UI components out-of-box, such as datepicker, tooltips, etc.
    • WebWork 2 has AJAX theme. Whatever it means, it sounds cool...
    • WebWork 2 tags are stylesheet-driven, making it easier to develop consistent pages.
    • WebWork 2 checkboxes are stateful, and require no special handling.

    The recent release of Spring 2.0 does not seem to have any work on this area.

    Is there any plan in the Spring team to develop similar features in Spring MVC in the near future? Or is the development work on Spring MVC halted?

    If the answer is no, we probably will have to choose Struts 2 as we need to have a continuously-evolving MVC framework that can support more and more complex UI components...

    How do you guys add AJAX and other complex UI components to a Spring MVC powered webapp?

    Any thoughts?

  • #2
    Just in case:

    Yes, I have read Matt Raible's "Web Framework Comparison" and other presentations...


    • #3

      I'm not an expert, but in my projects I use a lot of Ajax and my two suggestions are:
      1- Direct Web Remoting

      With DWR in few seconds you have your beans able to be used by javascript and then a lot of ui effects with the nuber 2.



      • #4
        Spring's Web commitment is for real

        Spring MVC has checkbox support with it's data binder -- since the early days, before WebWork had any support for checkboxes.

        The new Spring 2.0 jsp tags support styling the HTML that is generated with CSS via your standard CSS attributes like class. What does web work do beyond this?

        As Magnusa mentioned, DWR + Scriptaculous can be used to quickly give you Ajax effects within your application. There has also been some work done with JSON integration as a Spring MVC View technology (see the JIRA).

        To answer your general question, yes, the Spring team is very much committed to continually supporting web application development. This includes building more convenience and integration on top of the core web stack (MVC and Web Flow) going forward, particularly in the rich UI/Ajax and Rails-like integrated development environment areas. And including more showcases and samples. Development has not halted, no way - may I ask what gave you that impression?

        BTW, Rob Harrop will have a lot to say on new directions at The Spring Experience in his "Rapid Web Application Development" session. Rob is on vacation this week but I've pointed him to this thread for comment when he gets back!

        As one example of new areas I can speak to, I am working on the roadmap proposal for Web Flow 1.1, where we are looking to add a thin layer on top of its component model to support hierarchical, embeddable portal-like flow components (with the ability to integrate existing UI component libraries like JSF) We are in a unique position here, as SWF is a significant technology innovation (going 1.0 final this week) that goes beyond what is out there now, and that gives us and our users considerable leverage for some exciting new development.

        Last edited by Keith Donald; Oct 24th, 2006, 07:06 AM. Reason: Added note about Rob on vacation


        • #5
          Keith & Magnusa,

          Thanks for your replies. I'm now more encouraged and feel more confident in recommending Spring MVC in our upcoming new projects.

          I would love to hear Rob's presentation at "The Spring Experience" on rapid web application development. Unfortunately, I'm unable to attend. It would be fantastic if Rob can comment on this thread.

          I was a little bit disappointed when I read the new features in Spring 2.0 reference document for the lack of new features except form tags for basic HTML components.

          Actually, how can I become a watcher on the new features being developed?



          • #6
            I blogged about Rob's session at:



            • #7
              I like Spring MVC but an important piece missing is a MultiActionFormController, which is almost a requirement for complex pages. There's been an issue open for a long time :

              I hope this makes it into Spring sometime soon.



              • #8
                What is the future of Spring MVC?

                First of all, let me say, I really like Spring Web Flow. It is, IMHO, the best web workflow solution out there. (Although SEAM has some pageflow stuff that is maturing rapidly)

                My question is: What does the future of Spring MVC hold? Is there a road map or high level vision of where it is going long-term? As SEAM/Struts2/JSF mature, I'm curious to know where Spring MVC is heading. Any insight into this would be greatly appreciated.


                • #9
                  I would agree with Tom's comments. We're beginning to use Spring MVC and possibly Web Flow as well. There is a lot to like in the current versions, but it would be nice to get a sense for where things are heading. Specifically, what does the future hold that will make Spring MVC a compelling alternative to JSF/Seam and Struts 2?


                  • #10
                    Originally posted by sjivan View Post
                    I like Spring MVC but an important piece missing is a MultiActionFormController, which is almost a requirement for complex pages. There's been an issue open for a long time :

                    I hope this makes it into Spring sometime soon.

                    You can mix SimpleFormController and MultiActionController workflow right now (I first used this method about 2 years ago).

                    <bean id="fooController"  
                      <property name="delegate">
                        <bean class="com.acme....FooController">
                          <property name="commandClass" 
                          <property name="formView" value="someView"/>
                      <property name="methodNameResolver">
                        <bean class="org.springframework....PropertiesMethodNameResolver">
                          <property name="mappings">
                              <prop key="/**/multiActionUrl/**">
                              <prop key="/**/anotherMultiActionUrl/**">
                              <prop key="/**/simpleFormWorkflow/**">
                    FooController extends SimpleFormController, but the bean declared in your Spring MVC configuration is a MultiActionController that delegates on to your FooController class.

                    The invokeSimpleFormWorkflow method delegates to the SimpleFormController workflow. In Spring 1.2.x you could directly pass the request to handleRequest, but this is blocked in 2.x to prevent a possible stack overflow.

                    Of course, you don't get multiple SimpleFormController workflows with this method. Just the one that your controller implements by extending SimpleFormController.



                    • #11
                      Hi guys...

                      I'm a Java newbie so please handle with care....

                      I'm required by my company to use Spring. However my friend suggest me to learn webwork b'cos it is the better than Spring. This thread seem to support his statement.

                      Should I use Webwork instead of Spring MVC?



                      • #12
                        Well, there is Spring the lightweight javabean container and there is Spring MVC which is the web framework closely associated with Spring. Webwork integrates very well with Spring the javabean container. Spring MVC also integrates very well with Spring the javabean container. If your company mandates Spring MVC, then you're probably stuck with it. If your company only mandates the Spring bean container, then you have the choice of using either Spring MVC or Webwork/Struts2. It's really up to you.


                        • #13
                          well, actually, my company mandate me to use Spring because they don't know about WebWork, and I have a privilage to chose my own MVC IF I can state an acceptable reason. The problem is I'm quite sure that Spring is enough for my current task and I don't know how much effort I should do to migrate my system to WebWork MVC(and what tradeoff I should pay).

                          Is is worth to try?



                          • #14
                            If webwork is an option, I'd say that it is worth the effort of conversion if you are going to convert a significant percentage of screens. (Webwork and Spring MVC can live side-by-side to allow you to migrate gradually) You also have to weigh the retraining costs. (i.e. developers coming up to speed on the new framework) Then you have to decide if you should go with webwork or struts2. (Struts 2.0.x should be GA/production ready by the end of January)


                            • #15
                              Originally posted by svnstrk View Post
                              Should I use Webwork instead of Spring MVC?
                              Webwork, Spring MVC, Struts are action oriented frameworks as opposed to JSF and Tapestry which offer component based implementations. I would take a serious look at them as well. JSF is a standard for which the current problem is that almost all implementations suck. But with great support from the Seam community, we may have somthing to look seriously into. Irrespective of what u choose as the Web framework, keep an eye on the JSF integration points. The last time I checked, the integration of JSF with Spring MVC was not very mature. But, on the whole, Spring MVC is a very well designed framework with lots of hooks and customization points. It has very intelligent use of defaults - what the Ruby guys say *convention over configuration*. I am not sure though about SWF - how much will an XML based flow language scale .. Now that Seam is around, I would advise u to have a look there as well ..

                              - Debasish