Tutorial :Best Java web application framework for a PHP developer?


I had been life long PHP developer. But am now forced to write in Java (or at least on JVM) the final version of a prototyped PHP web application.

Would like to add that I am not quite unfamiliar with Java. Wrote applets in the old days. Besides, am familiar with most other scripting languages, plus RoR.

But web app in Java is making me confused with so many options. Therefore my question: which framework would you recommend for a PHP developer? Would prefer less typing, and less XML. Is there a RoR like framework in Java or in any of the JVM languages?


There is a RoR like framework for the Java Virtual Machine (actually a port of RoR) called Grails. It does not use Java but a Ruby-like language called Groovy. You are however free to mix Groovy and Java classes in your Grails projects.

There is also a port of Ruby called JRuby that runs on top of Java on the Java Virtual Machine --and yes, you can run RoR with it (see here).

Apart from RoR-like environments, the easiest framework to use with the less XML is the simpler Servlet framework. You only need to set up a web.xml and the rest is pure Java and JSP (a PHP like templating/logic dialect based on Java).

There is also Quercus a PHP implementation on top of Java. This will allow you to port your PHP code and even mix it with Java classes.

In order of prevalence and support, the option with the most commercial support, available documentation, books and jobs is the plain Servlet framework one --and then Grails, which is owned and supported by SpringSource, a major player on Java frameworks.

After you are familiar with the Java language and concepts, you could move to a higher-level web framework like Spring MVC or Struts 2, where, using Annotations (a kind of metadata added on code) you can do with very little XML or even no XML at all. See this for an example.


If you're not limited to Java, but anything JVM:

There are also experimental implementations of PHP in JVM:


I just switched from PHP to Tapestry5 - http://tapestry.apache.org/tapestry5/


did you noticed quercus? it is a PHP implementation in java: you write your application in PHP and execute it in a JVM


Maybe that you should consider lookind at Grails. It runs on the JVM, use the Groovy language that, in many aspects, is more close from scripting languages (while it's not), and the Grails architecture will remind you the RoR one.


Are you required to use Java specifically or do you just need to deploy on the JVM? JRuby could be a great alternative, that way you could write Ruby on Rails and deploy on the JVM. You could also checkout Groovy/Grails which is a Ruby/RoR type solution built specifically for the JVM.


The Stripes Framework is a Java web framework that is really easy to use. It's big on convention over configuration, so no XML files. Make a lot of use of annotations. You can be up and running with this in no time.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »