Use Struts + Hibernate for a simple web app? (only POJOs)

Discussions

Web tier: servlets, JSP, Web frameworks: Use Struts + Hibernate for a simple web app? (only POJOs)

  1. Hello.

    I'm building a simple web app (~20 screens; ~10 tables in a single database). After looking at frameworks such as Struts, Spring, Hivemind, for building the app and Hibernate, JDO, etc. for the persistence layer, I've decided to go with Struts + Hibernate (and POJOs for the business objects).

    QUESTION: Is this a good choice?

    My reason for Struts versus Spring is that it will be easier to find talent for maintenance of the system and Struts is already being used on other projects currently (where I work). I'm a consultant, so I want to leave behind code that is easy to maintain and/or find talent for (again, picked Struts for that reason).

    As for Hibernate versus JDO, it appears this is a much discussed topic but Hibernate appears easier to use (to me, personally) and the fact that it is associated with EJB 3.0, gives me some warm-and-fuzzy that it'll be around.

    To summarize, my objectives are:
    1. Keep things simple for quick development (less learning curve)

    2. Use lightweight stuff (i.e. no EJBs, no heavy framework)

    3. Make maintainability (ie. use industry standard stuff that you can find talent for easily such as standard J2EE, Struts, log4j, etc.)

    Any thoughts would be appreciated.

    Threaded Messages (11)

  2. It sounds fine to me. While some people say that Struts is old news, it still works fine for today and as you pointed out the current talent pool there can work with it.

    If you are going to use an O/R framework then hibernate is a pretty good way to go. Your clients shouldn't have any trouble finding people with struts/hibernate experience to maintain your app.

    You could still use a Ioc framework along with Struts/Hibernate if you wanted. Spring does have a web framework component, but you don't have to use it. Using Spring along with Hibernate version 2 provides some benefits over using Hibernate alone, but many of these benefits are included with Hibernate version 3. Using a combination of Spring/Struts/Hibernate is a workable combo. You could also use an Ioc container that has less extras on it like Hivemind.

    I've been developing a web app using Spring, Struts and Hibernate and the main drawback that I have run into so far is that both Struts and Spring want to define the Action classes in their own config files. So each action gets defined twice, once in struts-config.xml and action-servlet.xml. Not a huge deal.
  3. Thanks, David.

    What are your thoughts on JSF versus Struts?

    I'd like to use as much standard stuff (i.e. stuff Sun puts out) as makes sense but not stuff that doesn't make sense for relatively simple apps, such as EJBs.
  4. I haven't looked at JSF seriously enough yet to really evaluate one over the other. I'm sure Struts will solve your problem at hand and you are already familar with it.

    I'm not one of those people that have a phobia about using a "proprietary" java technology over a standard one. The simple fact is that some of the offical standard solutions offered by sun have sucked. While this doesn't mean that everything produced by Sun or the JCP process is going to be bad, it does mean that the offical stamp of approval means nothing to me. I really don't have a problem using proprietary open-source technologies in a project as long as they are well established projects. Whats somebody going to do, take away my Struts license?

    I plan to take a more serious look at JSF soon. But for right now I'm still creating new things in Struts.
  5. Hi,
     
    My experience on JSF over Struts is
    1 - Better Navigation control in JSF(only in faces-config.xml) including regular expression support.
    2 - Managed JavaBeans(POJOs) in JSF uses IoC/Dependency Injection(DI) pattern.
    3 - If you decide to use Spring, POJOs from Spring(Business Logic) can use in JSF.

    I think that Spring has better support for JSF integration than Struts.

    Just take a look at AppFuse

    http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse

    You will see JSF+Hibernate+Spring or Struts+Hibernate+Spring.

    And also, you can see ranking on MVC frameworks from JavaOne 2005

    http://www.theserverside.com/articles/article.tss?l=JavaOne_Day4

    Regards.

    Sithu
  6. Go POJO[ Go to top ]

    I would look seriously at the combination of Hibernate (or EJB3 or TopLink) + JSF.
    JSF components can bind directly to the POJO DTOs without having the Form Beans in the way as you get with Struts. It's a compelling combination.
    Throwing Spring into the equation will help with the transactional side, but I'd let JSF handle the page flow rather than trying mix and match JSF views with Spring WebFlow or MVC
  7. Go POJO[ Go to top ]

    Thanks.

    By the way, speaking of transactional stuff, wouldn't Hibernate handle that as well?

    I'm going to take a serious look at JSF today and decide by the end of the day whether to go with Struts+Hibernate or JSF+Hibernate. My only fear with JSF is that it'll go the way of EJB, where they'll end up redoing everything because the first two versions were too complex and/or too much overhead.
  8. Go POJO[ Go to top ]

    Ben,

    I wouldn't worry that much about it. From what I seen of the JSF spec its complex, but its nowhere near EJB 1.0 complex. The lead struts architect is also leading the JSF working committee so I doubt its going to be that bad. Even the struts project itself is moving towards JSF integration with their new Shale project.

    I've noticed that you have made a lot of posts on this forum regarding this subject and I think you are making way to big a deal out it.

    Any combination of the technologies you have asked about could be used to implement your project. None of them are the wrong answer. You should pick a combination and go with it. Either pick the set you are comfortable with now (I'm guessing struts and hibernate) or go with something new and use your project to evaluate the technology.

    Struts, JSF or Spring Web Flow are all going to work fine as your web framework.

    Hibernate will work fine as your O/R mapping solution, but so would toplink or a JDO solution. EJB is probably not what you are looking for, older EJB specs are to complex and the newer one is still beta. But you could make a viable solution out of EJB3 if you wanted to, EJB3 is way nicer looking than the older specs. You could even manage the persistance entirely using JDBC, it will just be a lot more more work.

    Spring or some other IoC container would be helpful for organizing your project. But its not necessary to use any of them. Spring does have some advantages when used with 2.0 hibernate. Again, its not necessary to use any of them. I'm building my first project using Spring and I really like it. It takes a bit to get used to the IoC concept, but after a bit you get used to not writing so much factory code.

    In any case there isn't a wrong answer in the stack, just different ones.
  9. Go POJO[ Go to top ]

    Hi, David. Thanks, once again.

    One of the reasons I'm making a big deal is that I recently found out that while my project is small/straightforward, the folks in my group (~20) are looking at the solution I pick as as a basis for new projects. And, since my app is small enough, it is less riskier to try a new technology combo versus going with the tried-true technologies being used on most projects currently in our group (i.e. Struts, Hibernate/JDBC).
  10. Struts Hibernate and Spring Tutorial[ Go to top ]

    HI, Visit: http://www.roseindia.net/struts/hibernate-spring/index.shtml. This tutorial shows how to develop User Registration and Login Application using these technologies. Regards Deepak Kumar
  11. STUPID RAILS V/S SOLID STRUTS[ Go to top ]

    Hello, put attention to this: in my job to somebody had the great(stupid) idea to mix different technologies Rails/jRuby/Spring2/Hibernate3 with different paradigms. In fact this web application after tedious and long times of development is running unstable fashion and very slow by each request (10 seconds). I believe that it is not the best choice to mix frameworks for environment scalable JAVA (STRUTS, SPRING, HIBERNATE) with RUBY for environment unscalable RAILS, Active Record. Some GURU or DEVELOPER in WEB J2EE could talk about so this brutality of the choice of these mixtures of frameworks. J2EE/STRUTS WILL NEVER BE SURPASSED BY ruby/rails....!
  12. you can check http://www.techfaq360.com/ for Struts Spring Hibernate Tutorials.