I love Java. It's great. In fact, I think Java code is just down right sexy! But, there are several things I hate about writing Java web apps:

  1. So many configuration files. I have yet to find a server/container/framework/etc that allows me not to have to create a web.xml. And frameworks only ever add to this complexity.

  2. I love the way PHP works. You drop files into a directory, and you can immediately browse them. Why can't Java do this? Java has perfectly fine reflection abilities to handle this. So why can't I drop a couple .class files into a directory, and then be able to immediately browse them? (I know tomcat can deploy from a directory, but that leads to....)

  3. And like PHP, why do I have to restart the server every time I want to redeploy an app? (Glassfish can do hot deploys, but I still have to package it into a .war file)

So, my question is: Is there any use, or and existing solution, for a Java server; that allows you to drop simple POJOs into a directory, and be able to immediately browse them? In essence, I want every thing PHP has, just in Java. Any thoughts?


How would you browse a simple pojo?

Just to touch on point #3, I think I'm right in saying that a java app needs to be restarted on re-deploy because it's essentially running all the time. PHP is handled as a scripting language, and so it's effectively "restarted" every time the page loads, because the code is interpreted as though it's brand new each time. Think of the java app as a windows service or UNIX daemon, you might be using it all the time, but it's running all the time. If you want to change a config setting, you need to bounce the service. The PHP page is like a perl script, it's re-interpreted on each execution.

Written by Lazy Bob

@Lazy bob, that functionality is available for JSP files, not compiled Java classes

Accepted Answer

Grails may address some of your needs. It favours convention over configuration (like RoR). I think the hot deploy issue is not as sealess as you'd like, however.

If your major concern is writing web.xmls and similar, you can always embed a web container (say, Jetty) into your application and configure it programatically. But (I suspect) that's probably not how you're thinking.

Written by Brian Agnew
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki