问题
I want to write a simple web application, on J2EE, with these characteristics:
- I don't need any AJAX, and it should even work with JavaScript disabled on the browser.
- It is a simple CRUD application
- I would need full control on the way each element is laid out on the page - no compromise on the GUI's look and feel.
- I can use plain old JDBC for data access - no o/r mappers necessary
- Bookmarking of pages is necessary (wherever it makes sense to bookmark, that is).
- Many of my users use tabbed browsing very much.
What I'd like the framework to do is:
- Give me a nice abstraction to retrieve GET and POST parameters
- Give me a nice facility to display validation errors and other errors to the user
- Give a set of standard safety features - prevent cross-site scripting, prevent the user from setting a dropdown input to a value that isn't there in the dropdown, et.al
- Be performant, scale well for over 200 concurrent users, on a not-so-powerful server. (no clusters - single node, a shared app server with multiple production applications)
- Be stable; because I'd like to have that application running without a major refactor for at least 3-4 years
I looked at a few frameworks, and this is what I felt..
- Plain Servlets/JSP - I need to code everything myself - this would take time, and probably have many bugs
- Struts (1.x) - Doesn't provide too many advantages over the plain servlet approach; while it does map POST and GET parameters to form beans, the other features I'm looking for aren't there; and I need to invest a lot of time coding them myself
- JSF - I'm scared of it because of the performance problem I've read about. It seems like the view construction and maintenance takes up too much memory. Also, JSF won't work well with bookmarks and tabbed browsers.
- Tapestry - I took a look at Tapestry 5. While it looked good, it too seemed to be incompatible with tabbed browsing and bookmarking. While there is certainly support for "activation context", it is only a single string. It can't restore the state with GET parameters and hidden form fields (yet). Additionally, there seemed to be concern about the longevity of the framework - it appeared that it evolves without backward compatibility.
- Apache Turbine - It looked good at first; but the fact that it's quite old and there's no much activity going on scares me.
Any suggestions on what would be good for me? Thank you!
PS: I'm constrained to use one that's licensed under Apache license (v2, preferably) or BSD license
回答1:
Spring-MVC is another option to consider
回答2:
Stripes is an MVC java web framework that pioneered the 'Convention over Configuration' pattern for java web development. Spring MVC has adopted some of these patterns but I still prefer Stripes because it does one thing and does it well.
回答3:
It is rather new java framework, but I think it looks pretty awesome
playframework
回答4:
Grails maybe? You don't have to use the o/r mapping (GORM) if you don't want to, you can use plain old JDBC
回答5:
How about wicket?
http://wicket.apache.org
- Component-based framework, with complete separate of markup and code. Each "panel" component is bound to a more or less plain HTML markup file, which lets you customize the appearance as precisely as you want.
- Encourages OOP, easy custom component-building and code reuse.
- Validation framework with feedback.
- AJAX support with built-in "fallback" behavior for javascript-less browsers
- Supports bookmarkable pages
回答6:
Thanks everyone. I'll build some sample apps tomorrow using Spring MVC, Stripes (and probably Wicket), and see them in action :)
I'll update this answer with what I find..
Thank you! -Pradyumna
PS: It's disappointing that I can't mark multiple answers as "ANSWERED" in stackoverflow.. :( I'll have to wait and see what I finally decide on..
回答7:
JSF - I'm scared of it because of the performance problem I've read about. It seems like the view construction and maintenance takes up too much memory. Also, JSF won't work well with bookmarks and tabbed browsers.
Try Seam framework
- improved performance (added conversation scope)
- fixed JSF to work well with bookmars and tabbed browsers
- many others pros :)
Seam is good for two reasons:
- It let you quickly create application (basic CRUD like RoR or Grails style)
- It will be a good foundation for further development.
I want to write a simple web application, on J2EE, with these characteristics: 1. I don't need any AJAX, and it should even work with JavaScript disabled on the browser.
With JSF good library (Richfaces or Icefaces) writing JavaScript code is reduced to minimal. Why JavaScript will be disabled on the browser?
2. It is a simple CRUD application
Seam is great for generating CRUD application via seam-gen tool.
3. I would need full control on the way each element is laid out on the page - no compromise on the GUI's look and feel.
This is work for CSS code. With facelets as templates you'll have less work to do.
4. I can use plain old JDBC for data access - no o/r mappers necessary For simple CRUD application ORM is really cool feature, with Seam you'll have it for free. But ORM isn't mandatory.
5. Bookmarking of pages is necessary (wherever it makes sense to bookmark, that is).
As mentioned with Seam isn't a problem anymore. In "plain" JSF thre are only POST requests and that is a problem.
6. Many of my users use tabbed browsing very much.
Seam introduce new scopes (conversation and buissines process) so now there is possible to open few tabs and simultanously do more than one task/flow.
What I'd like the framework to do is: 1. Give me a nice abstraction to retrieve GET and POST parameters
That's the feature of JSF.
2. Give me a nice facility to display validation errors and other errors to the user
Seam integrates with Hibernate Validator and have really good support for messages and i18n.
3. Give a set of standard safety features - prevent cross-site scripting, prevent the user from setting a dropdown input to a value that isn't there in the dropdown, et.al
IMO JSF libraries are good in this field.
4. Be performant, scale well for over 200 concurrent users, on a not-so-powerful server. (no clusters - single node, a shared app server with multiple production applications)
Perfomant- yes. Seam fix brokes statless application design pattern promotes statefull application. With using POJO in state from performance view is similar to other frameworks like Struts or Spring. For real world use cases see seam in production page.
5. Be stable; because I'd like to have that application running without a major refactor for at least 3-4 years
Seam and JSF are stable technologies.
回答8:
When you're trying out Stripes, you can get started quickly with either Rayures (with Maven) or Stripes-Quickstart (with Ant).
来源:https://stackoverflow.com/questions/1693422/which-j2ee-web-development-framework-to-choose-for-a-simple-accessible-applicat