选择一个好的网络开发框架
基于这个问题的公认答案,我已经设置了 NetBeans/tomcat 环境。 在测试此设置时,我尝试创建一个 Java Web/Web 应用程序,但对该测试应用程序的框架选择感到困惑。
选择是:
- Spring Web MVC 2.5
- JavaServer Faces
- Struts 1.3.8
- Hibernate 3.2.5
在我的阅读中(谷歌搜索和SO)并且很快就迷失在树林中,所以我正在考虑只选择一个,如果没有的话t pan out,以便稍后切换/迁移到另一个。这样的方法可行吗?
项目背景
(由于遗留代码,必须基于 Java)
它使用自签名小程序来进行客户端渲染和渲染。互动;
Servlet 检索客户端请求的数据集;
数据库可能位于某个远程服务器上,因此我打算使用 JDBC 来访问它;
遗留系统是基于 CORBA (ACE/TAO) 的,有许多需要转换为 Java 的 C++ 模块,并且需要更改进行 CORBA 调用的现有 Java 模块(幸运的是很少)以使用新翻译的 Java-模块。
如果您能想出更好的方法来处理这个项目,请告诉我。
(这个项目具有我喜欢的所有特征:有趣、具有挑战性,而且我学到了新东西)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先,总体上仔细研究一下整个 Spring 框架 并没有什么坏处。 文档从非常基本的模块开始,它的工作非常好一直到 Web MVC 层(您可以决定是否要使用它,例如,Struts 集成也是可能的 - 但我发现 Struts 总是很麻烦)。 Hibernate 可能是最流行的对象关系映射器框架。它用于存储、查询和检索域模型对象(您想要存储在数据库中的所有内容),但与 Web 层没有任何关系。
我个人不喜欢 JSF(另一个规范怪物,需要花费比实际需要更多的时间来了解它)。如果您喜欢基于小部件的方法(将页面与组件放在一起,而不是输出普通的旧 HTML),您可能需要查看 Google 网络工具包。
另一个 Spring 解决方案是 GRails。使用起来确实很有趣,即使您必须学习另一种(脚本)语言(称为 Groovy),您仍然可以在框架中使用所有 Java 遗留类,因为 Groovy 类与 Java 类兼容(反之亦然)。
顺便说一句。我认为 CORBA 是一种技术/协议/标准,特别允许您独立于语言访问方法和对象。维基百科:
那么为什么必须翻译 C++ 模块才能与 Java 对话呢?
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:
So why do you have to translate the C++ modules to talk to Java?
首先,将 Hibernate 从你的列表中划掉——虽然如果你有 ORM 需求,但与 Web 层无关的需求,我们建议你使用它。
那么我认为您有两个选择:
走任何一条路线都会让您致力于那个/那些 API,并且以后的切换永远不会轻松。
我的建议是:
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:
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:
我认为最好只选取最小值,然后根据需要添加。通过这种方式,您很可能会变得简单。
一个想法可能是从 Spring 作为“宏伟的事物计划”和集成技术开始。然后根据需要添加补充:
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: