Java Framework Choice Question

前端 未结 4 857
情话喂你
情话喂你 2021-02-06 18:48

We do have many frameworks available in Java. Struts, Swing, JSF 2.0, Spring etc are used as per their priority. Actually, I don\'t know how many they are as well!

But,

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-06 19:21

    We do have many frameworks available in Java. Struts, Swing, JSF 2.0, Spring etc are used as per their priority. Actually, I don't know how many they are as well!

    Swing is not a webbased framework. It's a desktop UI framework. You're probably confusing with Spring MVC.

    All of those frameworks are dividable in two kinds:

    1. Request based MVC frameworks (Struts, Spring MVC).
    2. Component based MVC frameworks (JSF, Wicket).

    A component based MVC framework is seen as a further evolution of request based MVC framework. Choose a component based MVC framework if you want more abstraction (i.e. you basically end up with a view and a model). Choose a request based MVC framework if you want more control over the controller part.

    See also:

    • Struts2 or JSF
    • Component based vs Request based Java frameworks
    • Choosing a Java web framework now

    But, as I am fresher to Java, even learning after their architecture, I cannot decide which framework can be used with what type of Projects !

    As a personal opinion, go for JSF 2.0.

    See also:

    • Sun JSF 2.0 tutorial
    • Coreservlets JSF 2.0 tutorial
    • Simple JSF 2.0 CRUD example

    Also, I am confused with mixed use of framework like Spring + JSF. What is the benefit to it ?

    Spring is more an injection (inversion of control) framework. One may say, it's the alternative to EJB. Spring MVC is a request based framework.

    See also:

    • Wikipedia: Inversion of Control
    • Spring vs others

    Another thing making me confusing is about the UI components available in market. Like, we do have Primefaces, Ice-faces, MyFaces, Rich-faces. They may or may not have been supporting AJAX in-built. They may contains some bugs as well. What is best choice for Framework + UI component that can directly provide a best feet solution for any project ?

    MyFaces is another JSF implementation and for the remnant you only mention JSF component libraries. Those are meant to be used on top of a JSF implementation. Which one to choose depends on which one suits your functional requirements the best (skinnability, ajaxability, enhancability, etc).

    As a personal opinion, PrimeFaces 2.0 looks the best.

    See also:

    • What's the difference between JSF implementations and component libraries
    • What's the difference between JSP/Servlet/JSF

提交回复
热议问题