Announcement Announcement Module
No announcement yet.
migrating Struts to Spring (long-winded) Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • migrating Struts to Spring (long-winded)

    Hello, everyone:

    I'm trying to determine the what/when/how/why of migrating
    a Struts/Hibernate application to Spring/Hibernate, and
    here's a list of what I've done thus far:

    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++
    1) I created an applicationContext.xml file

    2) I created an action-servlet.xml file with definitions
    for each Struts 'action' in struts-config.xml, such as:
    <bean name="/login"

    3) I added a 'controller' tag to struts-config.xml:
    <set-property property="processorClass"
    value="org.springframework.web.struts.DelegatingRe questProcessor"/>

    4) I added a 'plug-in' tag to struts-config.xml:
    <plug-in className="org.springframework.web.struts.ContextL oaderPlugIn"/>
    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++

    I've deployed the application and I can see that actions
    are delegated to the Spring controller, but obviously it's
    only a very small step in the migration path I'm still
    quite far from the point where I can answer the question,
    "what does this [Spring code] buy us?"

    Do I need to specify the 'forward' elements in the beans
    in action-servlet.xml?

    How do I handle the global 'forward' elements in the
    struts-config.xml file?

    How can I determine whether we ought to do a full
    migration from Struts to Spring, or just integrate
    Struts with Spring?

    In the former case, is there a step-by-step example
    available of how to perform this migration?

    The motivation for our migration from Struts to Spring
    is to leverage JSF for the view layer, Hibernate for
    the persistence layer, and Spring as the "glue" that
    will enable us to add/remove components whenever it's
    deemed necessary to do so.

    Comments/feedback is welcome....



  • #2
    I'm trying to determine the what/when/how/why of migrating
    a Struts/Hibernate application to Spring/Hibernate
    Take a look at the JPetStore sample (in the distribution) which can be run using Spring MVC or Struts.

    "what does this [Spring code] buy us?"
    Do you mean Spring vs. non-Spring, or benefits of Spring MVC over Struts? This thread covers a bit of both.

    The motivation for our migration from Struts to Spring...Hibernate for
    the persistence layer
    Spring will work with Struts, so you don't need to remove Struts to use the hibernate-persistence part of Spring.


    • #3
      Thanks for the feedback, and I'll look at the PetStore code.
      Since all the people in my company who are involved in
      web development are familiar with Struts, they want to see
      tangible/convincing evidence that Spring will simplify their
      daily work (i.e., more than Spring Is A Good Thing), after
      which I'm sure they will make the effort to learn Spring.

      It seems to me that a "fusion" of Spring and Struts, which
      entails maintaining the three XML files struts-config.xml,
      action-servlet.xml, and applicationContext.xml is a only
      a mechanism by which Spring can be introduced as a
      "glue" component (and similarly for the Hibernate side).

      In other words, if we replace our current Struts/Hibernate
      combination with a Spring/Hibernate combination whereby
      we define our Struts actions as Spring beans in the
      action-servlet.xml file, this change along does not provide
      any significant savings in development time.

      I need to determine how much change is needed to our
      code base (and how much effort required to do so) in
      order to be able to say to our developers, "this is what
      we need to do, how to do it, and this is how/why it will
      save us work", sort of analogous to persuading people
      to migrate from Struts to JSF