views:

124

answers:

2

Hello

I am a newbie with Java EE 6. I started with JSF 2.0, Facelets, Managed Beans and really liked it. It was a great switch from JSP and servlets. It also made me a confused person. It may be the lack of my knowledge, but I have many questions swirling in my mind.

Are Facelets and Managed beans a direct replacement of JSP and Servlets. (The job requirement here still focuses on JSP and Servlets, will the market/global trend move towards Facelets or the demand of JSP will remain)

What about integration of Struts 2.0, Hibernate and Spring with Java EE 6. I have seen lots of tutorials and working examples of these technologies with JSP, but havent them with Facelets.

Do correct me if any of my understanding is wrong.

+1  A: 

Struts 1 was a framework that added additional structure above a JSP/servlet application. I would develop with Struts in preference to raw JSP, and in fact many developers using JSP before Struts emerged evolved their own equivalent frameworks.

JSF is in effect a standardised equivalent of Struts 1, whose development was heavily influenced by the originators of Struts. So JSF is more or less a direct replacement of Struts, that in principle should be widely supported by JEE App Server vendors. The adoption of JSF is not uniform, there are enthusiastic users, and otehr folks who stick with Struts 1. I have no statistics to tell you which technolgies are more widely used.

Both Struts and JSF and Model/View/Controller frameworks, and neither address how to implement the Model - in particular they don't say much about persistence, hence you need something in addition to Struts/JSF which is where Hibernate and JPA come in.

To my perception the emerging trend is to build UIs using Dojo or JQuery, with REST services, It appears that Struts 2 is attempting to address this problem domain, with rich widgets in the browser. This is interesting and worth study. Personally I've not used Struts 2, nor have I encountered it professionally, probably because I'm working with products that major on Dojo and iWidgets. I'm planning to give Struts 2 some attention.

djna
he talked about struts2 and not struts, i think this is a difference.
jogep
+3  A: 

My personal view:

  1. JSF is built on top of JSP/Servlet -- it's not really a replacement, but a higher level abstraction.
  2. Ideas in Hibernate and Spring have somehow been integrated under JPA and CDI.
  3. Basic knowledge of JSP/Servlet is still usefull, what's not needed is knowledge of JSTL.

That said, there are two broad categories of web framework: component-based, and action-based. JSF is component based and each component is responsible of its own rendering and callbacks. Struts is action-based, where the controller forward to a view explicitly. Both can be seen as MVC, but the approach differ largely between the two. There are other frameworks of both types around (wicket, play, etc.)

Which kind of approach is best is subject to taste and opinion.

ewernli