Java Framework Choice Question

半城伤御伤魂 提交于 2019-12-03 14:12:43

问题


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, as I am fresher to Java, even learning after their architecture, I cannot decide which framework can be used with what type of Projects !

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

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 ?


回答1:


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



回答2:


There are no Silver Bullet.

If you can't choose one let your software architect choose it for your needs. Or you have to play with all of them.




回答3:


There are Frameworks for different Kind of Problems.

JSF is a Web-Framework (or better an API for a Web-Framework) that's based on Servlets/JSP and is handling the Web-Frontend for you, while Spring is a framework to configure applications and tie application components together to a running application.

So you can build small components that are using a JSF Framework to create a Web-UI and interact with the user, using Hibernate to store and retrieve the data in the database and tie them together with Spring to create a full-fledged Web-Application.

Since JSF is just an API, you'll need an implementation, like IceFaces. If you are following the specs clearly, the implementation can be easily replaced. So you can switch from IceFaces to MyFaces without rewriting the full application.




回答4:


Right. It looks like the question is about everything. In particular it mentions Struts and Swing over the comma. Swing I am sure is also a farmework, but that is one of many non-web UI frameworks. There are also ORM frameworks and many other types of. May we call EJB and Spring frameworks? I bet we may. Bad thing is that while on the intuitive level we may often tell if something is a framework, I've never seen any good definition of what a framework in software is. In about 50% of cases we are talking about Web frameworks, Like Struts, JSF, Wicket, Velocity, HybridaJava or MVC part of Spring. There are about 50 of only Java web frameworks, all of a very very different nature and value, but comparing them is a real headache. Recently I have noticed a new and growing page about web frameworks on wickipedia. Way overdue, but it is excellent to have it now. The table there is a good start for comarisons.



来源:https://stackoverflow.com/questions/3062188/java-framework-choice-question

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!