Which framework to choose for a Java application

Hello,
I am looking for a Java framework that may be suitable for a great site and compatible for site RIA (Rich Internet Application).
I hesitate between Google Web Toolkit, [URL=“http://tapestry.apache.org”]Tapestry, [URL=“http://vaadin.com”]Vaadin, [URL=“http://www.springsource.org”]Spring or [URL=“http://grails.org”]Grails.
I await your advice and opinion.
Thank you.

Consider using HybridJava

I think you should consider Spring 3. It is easy to use and works very well. It’s dependency injection is easy to understand and implement. You can use MyBatis 3.x with it easily and have a complete annotation based solution if you choose not to go with Hibernate etc.

Grails is easy for beginners and start ups if you grasp the language idioms but at the end of the day nothing you can do with Grails cannot be done in Java+Spring.

You can use Maven to build an entire website framework pretty easy.


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.your.namespace</groupId>
    <artifactId>yourArtifact</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>Your Project Name</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <org.springframework.version>3.0.6.RELEASE</org.springframework.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>net.sf.flexjson</groupId>
            <artifactId>flexjson</artifactId>
            <version>2.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.0</version>
        </dependency>

        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.5</version>
        </dependency>

        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>2.0</version>
        </dependency>

        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc14</artifactId>
            <version>10.2.0.3.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>

        <dependency>
	  <groupId>javax.servlet.jsp</groupId>
	  <artifactId>jsp-api</artifactId>
	  <version>2.1</version>
	  <scope>provided</scope>
	</dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.0.4</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.0.6</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
            <type>jar</type>
        </dependency>
	
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>1.0.2</version>
        </dependency>

    </dependencies>
    <build>
        <finalName>your_file_name</finalName>
    </build>
</project>

From there you simply follow normal web app standards for building servlets and then adhere to spring api’s and a few conf files and your golden.

I think Grails is an excellent suggestion, one of the only minor drawbacks is that there is a slight learning curve as the developer has to learn about groovy, which is slightly different from Java. I would also suggest looking at Spring Roo, which is very similar to Grails but uses pure Java.

Spring Roo is essentially Java on Rails.

The good thing about ROO is that it is great for RAD. The utterly terrible part of it is that it essentially ties the bulk of your application to Spring when it probably shouldn’t. You’ll use Annotations that are completely specific to spring. The only good thing going for it is that you can do a lot of things from the command line. You can do the same thing as Roo using non-annotated POJOs just by knowing the basics of Spring. Honestly, having done both I don’t see the true benefit of Roo when it comes at a great price. One huge Java no-no is becoming too vendor specific.

The best i have worked with is play! framework

“The best i have worked with is play! framework” - so bad for you.

why so bad, can you give a detailed analysis, or u just wished to some mockery. I agree i am a newbie but there is room for improvement everyday.

The style of your message (“The best i have worked with is play! framework”) is typical for play! team which pushes this type of aggressive advertisement to each and every forum. I may not believe that you are a “newbie” you pretend to be.
If you are a “newbie” and never worked with any other framework but with play! then you message does not make any sense.
If you are a “newbie” and worked with at least one another framework, please tell why that other framework is worse than play!. Then I may believe that you are a “newbie” and I will tell you why play! is not the best.

Think u are getting something wrong here, maybe from d way i made my initial statement. I still see myself as a newbie, I sometime used vaadin framework, but i couldnt make an headway as i did not have enough knowledge of its api at that time, so i left it after some few weeks of struggle and then i moved on to wavemaker. I went well wit its wysiwyg but had problems linking it with my java codes and using d dojo whatever. I also left dat after some months of struggle. It was then i discovered play framework and even with my little knowledge, i was able to design a working web application for the first time and even with a good support at its google groups. That was why i said it is d best i ve used so far. Although vaadin has a chat group but they do not really respond to foolish questions that newbies tend to ask like compilation problems and all that. Play! might not be d best, but it is d best for me that i have used so far. Still trying out others maybe i will get another best. Thanks Alex for ur observation anyway. Which framework do u use.

So it looks like the only server-side web framework was play!.

Before answering your question, there is no such a thing called RIA or Web 2.0 or other crap… To me it sounds like you want to make Web application using Java. Here’s my advice.

Your core framework should be Spring Framework as a back-end solution. For the front end, you got many options.

  1. GWT - Not my preference but if you’re weak on Javascript but want to have great UI then use it. Check out ExtGWT
  2. ROO - As someone said it’s Java on Rails. This is good for someone who knows little about Spring
  3. Spring MVC - This is a very good choice but doesn’t have a nice UI library. Of course, you can use JavaScript library like YUI or ExtJS

…I could probably go on and on…but it really depends on the learning curve you want to take. My choice would be

  1. Spring Framework
  2. MVC (RESTful Service)
  3. ExtJS
  4. Hibernate

I think above recipes are fairly good combination.

All sounds good but Spring MVC. What is its value compared to most other presentation layer frameworks? Say to JSF, Tapestry, Wicket? None.

Some of the more popular frameworks that top of the list of my framework alternatives are:
Struts is an elegant framework that handles the flow of the application and a lot of other routine tasks.
Cocoon is great if you are looking for a framework that has XML capabilities at its core and that makes great use of XML and XSLT.
WebWork is part of the OpenSymphony set of components and is considered to be a nice and simple framework

I won’t use any fancy presentation library from JSF/Tapestry/Wicket. My Spring MVC will only listen to RESTful Web Service that responds back in JSON. Then, I’ll use ExtJS who can parse the JSON and process the presentation.

I think you’re a bit outdated. Struts 2 is essentially the new WebWork. Still, there are MANY Java framework to choose from. I typically choose Java technology that are most demanded. For example Spring MVC > Struts 2. It is possible that Struts 2 is more powerful than Spring MVC but I’m just going for more $ for the bang. As of right now, Spring Framework is becoming the ONLY choice to ANY java coding. If it was a personal project then I wouldn’t mind playing w/ Grails/Roo/GWT/etc… but c’mon I rather do million other things than learning for fun. That’s just me.

From my recipe, I like to add “Spring Data - JPA”. This is new subproject that’s officially released Nov 2011. It already became “must” use tool for future projects.

If so then you possibly indeed do not need much from the server-side presentation-layer technology (in your case Spring MVC). Naturally this does not support your statement that Spring MVC is better than some other technologies of that kind.

By all means, I wasn’t saying “technically” that Spring MVC is better than say other framework like Struts 2. For me, what defines “better” is determined by most demanded skills from say monster.com. You maybe right though, there’s probably many MVC that may suit better. This is the exact reason why I chose Java because that’s always either been #1/#2 most demanded skills.

You are right. The answer depends on who is asking. As to Struts 2 v.s. Spring MVC a.f.a.i.k. the current version of the latter supports and recommends using the former. So no point in arguing that one is better than another. For me the words “Spring MVC framework” sounds more like “A placeholder of framework” because its own message is practically empty.