views:

274

answers:

8

I'm a newbie in Java world, but I got solid knowledge of RoR and ASP .Net MVC.

I need to develop a web application which will serve as a web UI and also will provide web services for other applications to save and get data and run some async jobs. I don't have any experience in Java EE and I would like to avoid it because even setting up glassfish and jetty gave me couple of rough hours and some hours after figuring how to setup Spring MVC properly.

I took a look at Play! framework - I thought that my search was over before even started, but it turned out that Play! didn't have proper unit tests for itself as I see them (it had only couple of unit tests and some functional tests) so I feared relaying on something that wasn't tested - also because it relies on static methods for controller actions I thought it will be hard to write unit tests for it.

After that I took a look at Spring and Spring MVC - but because it requires a servlet container to run I spent enormous amount of time trying to setup it with glassfish or jetty. The biggest issue with Spring is lack of up to date documentation with new features. Even documentation for 3.0.3 still concentrates on how to configure it through xml rather than using annotations.

I looked at Grails but because I'm not the only one who will be developing this application I expect a lot of complains about learning new language. Also because Grails has same 'magic' as Rails I prefer to stick with something simple and transparent even if it will require more code to write.

So my question really what else frameworks for Java I mist?

A: 

One fairly new entry in Java lightweight MVC frameworks is Wicket. Or is that more of a component oriented framework? Anyway, it's easy to get started with and works well. There's less XML than in other frameworks, most of your work is done in code. I believe the author is the same guy who earlier wrote (most of) Java Server Faces, and he brought some of his experience from there.

You're not going to be developing Java Web applications without an application server (well, at least a Web application container), so you'll end up biting the bullet sooner or later. Tomcat and Jetty are both very solid and versatile Web app containers.

Carl Smotricz
I took a quick look at Wicket - boy, how I hate from "addLabel" things when working with UI - I had too much experience with .Net WinForms and WebForms which had something similar - and it was one of the features that killed them. Thanks for the tip anyway, but I'm looking for something MVC based, I had enough of my time dealing with component frameworks in .Net.
sha1dy
+1  A: 

I suggest the Stripes framework:

  • Lightweight
  • Action based
  • Convention over configuration approach
  • No XML
  • Smart and fun to use
  • Much positive feedback (search on SO)
Pascal Thivent
Thanks, but I got some concerns:- Absence of good documentation;- Latest release is a 8 months old (looks like a dead project to me);- Action based (I prefer control based, those getters/setters for HTTP parameters and for templates are looking very strange and out of place to me, other frameworks provides them as parameters for controller methods or at least as a map objects).
sha1dy
@sha1dy 1. Stripes is well documented (I don't know why you says the contrary) 2. Do you need new features requiring a release? Then create some Jiras (according to [the users mailing list](http://news.gmane.org/gmane.comp.java.stripes.user), it's not dead 3. I don't know what a control-based framework is (they are either action-based or component-based in my world). Given your (very) high level of expectations, I think you'll have to either roll out your own framework... or lower them.
Pascal Thivent
Stripes quick start is a really quick - in terms of how short it is. As a good documentation I mean documentations for .Net ASP MVC, absolutely wonderful RoR, even Play! has a very solid tutorial section and structured reference. Stripes in terms of docs hasn't got anything of that. Sorry about control-based framework, I thought (from looking at quickstart) that Stripes requires each action to be a class with something like do or execute method - but I was wrong. Still why does it requires parameters to be a fields? Is it something that Java dev used to? Never seen such approach.
sha1dy
Regarding my expectations - I just want something that will give me ability to start developing web application using Java without configuring lots of xml, reading tons of somewhat out of dated docs (spring), scratching my head trying to start it (servlet containers), learning new languages (groovy). Ruby has it, Python has it, even hated .Net now has it. It was a shock for me to didn't find anything like that in Java. The only thing that fits me is Play! but it doesnt support heavy unit testing approach. Grails requires Groovy to learn and Spring is just over documented.
sha1dy
Still looking for options tho.
sha1dy
@sha1dy: Well, I think that Stripes fits well in this picture (and you are overestimating its complexity). But that's just my opinion and I still wish you good luck.
Pascal Thivent
Thanks, I'm looking at it right now - when you said stripes is well documented, maybe you mean documentation outside of stripes website or a book about it?
sha1dy
@sha1dy: No, no, I meant that the website (and the users mailing list) was good enough for me, I didn't find the documentation crappy.
Pascal Thivent
@sha1dy: A Java Web framework without a servlet container? Lotsa luck with that!
Carl Smotricz
+3  A: 

I suggest using Spring MVC and simply use jsp, tag libraries and a healthy dose of discipline to build your applications. This has the advantage of being mainstream, lots of people know how to use it, large community, and the documentation is not that bad (most other projects are worse). If you need more functionality later on, there is lots of more Spring modules you can add (e.g. Spring Webflow if you need session scope transactions, Spring Webservices, etc.).

Another tool that is worth looking at is appfuse, which generates a bare bones project for you with lots of best practices. Appfuse can generate the code for several different frameworks, amongst which:

JSF, Struts 2, Spring MVC, Stripes, Tapestry 5 and Wicket

This will allow you to play around with them more easily and see which one you like best.

My personal opinion:

JSF - too complicated

Struts 2 - no personal experience but did not find positive feedback on it.

Stripes - don't know it

Tapestry 5 - No experience with it, seems to be technically well thought out. I do have experience with Tapestry 4 though and the biggest problem we had with that was lack of documentation, no evolutionary path to T5 and difficult to find people experienced with it. I also don't particularly like the server side state model they use for their applications (similar to JSF). I find it leads to messy code really quickly.

Wicket - No personal experience

Good luck with it.

Marc van Kempen
+1 for JSF being too complex
MatthieuF
+5  A: 

Just a note that although Grails does use Groovy as the main language and you state this as a reason for not using Grails (developers having to learn a new language) - Most valid Java code is valid Groovy code. For Java developers, learning Groovy is a breeze since it is so close syntactically.

When I started learning Groovy after being a Java developer for 10 years or so, I was up and running within days, and the nature of the language similarities meant I could learn about the more dynamic and clever features of Groovy and start using them as I went along.

The best thing is that Java developers, once they've started doing a bit, actually like programming in Groovy - it almost becomes fun! (as far as programming can be fun :) And it doesn't take long to learn the "magic" in Grails (essentially the conventions used over configuration).

You said you need a Web UI, Web Services, and Asynch jobs. Grails has many plugins that would get you up and running with these straight away - e.g. Quartz plugin for asynch jobs, CXF plugin for webservices (although its even easier to just roll your own REST style XML services)...

Trust me, given what you said your requirements are, Grails should definitely be at the top of the short-list.

Good luck!

Chris
+1 You said exactly what I wanted to answer. Don't fear Groovy! After playing around with Groovy for a while you will feel at home very quickly and you will NEVER go back to Java again.. :-) In retrospective, it's unbelievable how much code overhead you have to produce in Java to do the most trivial things.. So, trust Chris and me and give Groovy/Grails a try, you won't regret it.
Daniel Rinser
I will definitely look at Grails - also I like that it's built on top of Spring and using proved components (Quartz).
sha1dy
werner5471
A: 

You should definitely check out Play Framework. It has (as pasted from their overview page):

  • Simple stateless MVC architecture
  • HTTP-to-code mapping
  • Efficient templating engine
  • JPA on steroids
  • Test driven development (if you like it)

and it's a 'Full-stack application framework'.

The documentation is also great, from screencasts and setting up your favorite IDE (NetBeans, Eclipse and IntelliJ supported out of the box) to controllers, templates and so on...

moondowner
Calling Play's documentation "great" is a huge over-compliment. I've been using Play for a project for the last month and detest the lack of good documentation, the stupid name (= impossible to Google), and the static actions.
Coronatus
+1 for Play.@Coronatus: try including "playframework"|"play framework" in your search.
sirmak
I guess you haven't read my post because I already looked at Play! and it's not built for TDD - TDD imply writing small tests and slowly moving to the goal - in Play! you cannot test the controller that way - you should parse overall result or use Selenium which is intended for acceptance testing. Also they even don't have full coverage for there own framework (no tests for JobsPlugin for instance). So, yes, Play! looks promising, but not this time and not for something solid.
sha1dy
@sha1dy, I haven't used Play (except trying a starters tutorial, on a daily basis I code in Tapestry) but it's the most lightweight framework I've read about, and it has MVC. Let's hope that in a future release they'll focus more on unit testing.
moondowner
A: 

I'd strongly suggest that you give Grails a try, despite your initial objections against Groovy (see also my comment to Chris' answer). Believe me, you will love Groovy (and Grails), and it's really no big deal to get familiar with this "new" language. There are many similarities with Java, but there is so much more that really boosts your productivity and makes coding fun again. Besides, the Grails documentation is quite good and the community is great.

Anyways, if you really don't want to use Grails because of it being based on Groovy, you might also be interested in Spring Roo, which is purely Java-based. I haven't tried it myself, but it looks very promising so far.

Daniel Rinser
A: 

Definitely take a look at Rife as well.

Yishai
A: 

I would suggest Lift. You have to learn Scala, yes, but it's well worth it.

That said, as learning a new language may be an issue, go with Struts 2. It's good enough and it's a highly demanded framework in companies, so the experience will be useful in the long term.

Pere Villega