views:

446

answers:

5

Hi,

Soon I will have to start a web project for a company, and I now need to choose a technology to build the app. I'm thinking about using Java, hence I'd like to find a framework that will help me building the app (I'm used to PHP framework such as CakePHP & CodeIgniter).

What I don't understand is that it seems to exist a lot of framework and technologies that don't have the same goal. Action framework, Component framework ... what can I do with one I can't do with another ? It seems a java web app should be developped by mixing a lots of different technologies, hence I'm a bit lost ... I've had a look at differents java frameworks, such as JSF, Stripes, Struts2, Tapestry, Wicket and Spring. About the later, I don't quiet see what are the different parts of this framework, what can it do for me and what it can't. What can I take from Spring and what I don't need...

Hence : what do I need to build a java web application ?

I've already used JSF for a basic CRUD app, but I'm trying to find something that may better suits my need. The app we'll have to build will be both a community platform as well as a merchant site, with sensible datas to protect :)

About the ORM, I guess I'll just go with Hibernate ... Also I've heard about Maven or Ant, in what way can they help me ?

Any advice/guideline would be much appreciated :-) Thanks in advance.

Edit : what my needs are : a java framework that is :

  • well documented / easy to get help / as easy as possible ...
  • the more java, the better
  • Ajax friendly / Facility to build nice UI ...
  • Internationalization
  • Still being a student, Marketability of Skills might matters ...

The app to be build is both a

  • Community site : web 2.0, CRUD
  • E-commerce site

full specs aren't finished yet.

+1  A: 

I suggest you have a look at Grails. Grails is a "coding by convention" web application framework build upon a stack of proven Java frameworks (Spring, Hibernate, ...) and using the Groovy language..

The beauty of Grails is that you need little knowledge of Spring, Hibernate, etc. to get started. But afterwards you still have access to the full power of these frameworks should it be necessary.

Ruben
I think I'd like to use as much Java as I could :)
Sylvain
Groove is basically Java with added features... and you can use pure Java pretty much wherever you like outside the core classes required by the framework, it integrates seamlessly with Groovy.
Michael Borgwardt
+2  A: 

My favourite is definitely Spring. The new Spring MVC 2.5 is easy and quick to set up, lots of annotations to help you wire your controllers declaratively which saves you a lot of typing. It also integrates with the Spring container which is definitely my favourite light-weight J2EE replacement container. I usually combine SpringMVC with simple JSP, but there are a lot of other view techs to choose from. For persistence I usually use Hibernate. Might be worthwhile to take a look at Spring ROO which is kind of like Grails without Groovy. Spring Security offers a nice and easy declarative way of doing security and integrates into a whole bunch of authentication technologies.

Maven and ant are both build tools while maven also handles dependencies for you. You "just" set up descriptors that describe the libraries you want and the version requirements, and maven will download all libraries and their dependencies for you. It forces you to follow a certain project layout, though. For ant there's ivy which does dependencies.

fforw
I don't think Maven forces you to follow any specific project layout, it's just that you have to do a lot more configuration-over-convention if you don't.
Andrew Swan
I heard about that you can change the project layout with even more than the non-trivial amount of configuration for dependencies. I'm not really a fan of maven -- or any other project dependency management tool. They all seem to end up requiring more work than just coping with dependencies by hand.
fforw
+2  A: 

Definitely use Spring for the back end; there's an excellent community on their free support forum (you can also pay for more formal support).

Regarding your decision to use Hibernate, you might want to code against JPA in order to decouple your app from Hibernate (which is one of several JPA implementations).

If you want an Ajax front-end, it's worth taking a look at the ZK framework; it'svery easy to use without having to learn JavaScript, and avoids having to use plumbing libraries like DWR.

Andrew Swan
A: 

The advice of others to use Spring is an excellent idea. You will find that you will actually use a number of different frameworks together because each framework solves a slightly different problem.

I would suggest that you invest some time with each framework or technology before jumping in but you will eventually want to get them to work together. You may want a Struts + Spring + Hibernate setup for instance. Configuring them could be a headache.

So I suggest that you use AppFuse which helps by generating the basic application with basic functionality. Its a huge time saver. You will of course need to understand the different frameworks that are configured for you so its not a magic solution.

Vincent Ramdhanie
+4  A: 

This is a very tough question to answer, having been in your situation recently I will try to give some insight. Basically, with Java there is a ton of choice for frameworks and no one can really tell you which one is best-fit for you, what we can do is give you a breakdown of some of the technologies.

The following is what I have come across in search of the same answers you want.

Java has a bunch of technologies that try to provide a full-stack solution. These technologies can be broken up into other technologies but work well when you use them together.

Basically, there are 3 tiers to web applications, the presentation, business and data tier. The presentation tier is the front end, what the user sees. You can generally mix and match technologies for these three layers. You could for example use a stripes front-end with the Spring framework for IOC and Hibernate as your ORM.

There are many great technologies that you can use for the presentation layer, including Spring-MVC, STRUTS, Stripes, Wicket, JSF/SEAM and Tapestry among a few. Most of these use a JSP for the view using JSTL, with the exception of wicket which actually full separates the html from the logic by using Java "components" (POJOS). There are benefits and drawbacks to both approaches. The benefit of the wicket approach is that you have static typechecking and a complete separation of the html so you can hand it off to your designer.

For the business layer generally people use some sort of Inversion of Control framework (IOC) for Dependency Injection (DI). The popular frameworks for IOC are Spring and Seam, these have associated technologies like Spring-security and generally are supported by the other technologies. Google Guice seems to be popular for a straight DI framework.

Finally, for the data layer most people tend to use Hibernate or JPA. There are others, but I have no experience with them and cannot offer any more information.

Tapestry is another framework that attempts to be a full stack from what I understand and takes a wicket like (or I guess Wicket takes a tapestry-like) approach. Grails is yet another full-stack framework using Groovy and built on top of Spring and Hibernate. If you like Rails, Grails is pretty good.

Most of these technologies have a lot of information available and very active mailing lists / IRC chatrooms. What you need to do is take a look at them and then decide which approach is the right one for you. No one here is able to tell you what you will like.

If you want a recommendation, I would like to one day use a Wicket/Guice/Hibernate stack.

kgrad