Selecting a good Framework for web-development

允我心安 提交于 2019-12-11 02:46:05

问题


Based the accepted answer to this question I've setup a NetBeans/tomcat environment. In testing this setup I'm trying to create a Java Web/Web application, but is stumped by the a choice of frameworks for this test-app.

The choices are:

  • Spring Web MVC 2.5
  • JavaServer Faces
  • Struts 1.3.8
  • Hibernate 3.2.5

In my reading-up (googling & SO) and fairly quickly got lost in the woods, so I am considering just picking one and if it doesn't pan out, to later switch/migrate to a different one. Would such an approach be feasible?


Background on the project

(Must be Java-based due to legacy code)
It uses a self-signed applet to do client-side rendering & interaction;
Servlets retrieve data-sets requested from the client;
Database may be on some remote server, so I intend to use JDBC for accessing it;

The legacy system was CORBA (ACE/TAO) based with lots of C++ modules that need to be translated to Java, and the existing Java-modules (fortunately few) that make CORBA-calls need to be changed to use the newly translated Java-modules.

If you can come up with better approach to handle this project, please tell me.

(This project has all the hallmarks of what I like: it is interesting, challenging, and I learn something new)


回答1:


Well first of all it can't hurt to take a close look at the whole Spring Framework in general. The documentation is quite good starting at the very basic module working it's way up to the web MVC layer (where you can decide if you want to use it, e.g. Struts Integration is possible, too - but I found Struts always to be a hassle anyway). Hibernate is the probably most popular Object Relation Mapper framework. It is used to store, query and retrieve you Domain Model Objects (everything that you want to store in the database) but doesn't have anything to do with the web layer.

I personally don't like JSF (another specification monster that takes way more time to get into it than it needs to). If you favour a widget based approach (putting you page together with componentes instead of outputting plain old HTML) you might want to have a look at Google Web Toolkit.

Another Spring sollution is GRails. It is really fun to use and even if you have to learn another (scripting) language (called Groovy) you can still use all your Java legacy classe in the Framework because Groovy classes are compatible with Java classes (and vice versa).

And btw. I thought that CORBA is a technology / protocol / standard that especially allows you to access methods and objects independently of the language. Wikipedia:

The Common Object Request Broker Architecture (CORBA) is a standard defined by the Object Management Group (OMG) that enables software components written in multiple computer languages and running on multiple computers to work together, i.e. it supports multiple platforms.

So why do you have to translate the C++ modules to talk to Java?




回答2:


First of all, cross Hibernate off your list - while you'd be advised to use it if you've got an ORM requirement it's not related to the web-tier.

Then I think you've two choices:

  • Spring MVC and JSF
  • Struts

Heading down either route is going to commit you to that/those API(s) and a switch at a later date is never going to be painless.

My advice would be:

  • use Spring MVC - you'll likely be using Spring anyway and so it's a natural choice.
  • ignore JSF, write the HTML yourself, using JSTL to render beans.
  • use JQuery/JavaScript to enrich the user experience.
  • use Hibernate for object persistence.



回答3:


I think it is a good idea to just pick up the minimum, and add as needed. Chances are that you gain simplicity that way.

An idea could be to start with Spring as your "grand scheme of things", and integration technology. Then add complements as needed:

  • persistence : Hibernate
  • javaScript : pick a js library that goes well with the Spring MVC module you're using


来源:https://stackoverflow.com/questions/1404115/selecting-a-good-framework-for-web-development

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