views:

138

answers:

6

Hello all

I am now in the process of choosing framework for our web application. I am coming from java/c++ background and built web front ends based on java, but for inner network applications ( not public internet ). I would like to hear what do you think about using java as framework for building web application for the public web. good/bad/what ever ...

+4  A: 

This very popular question may provide some insight: Why do people use Java? Many of the answers there deal with web development.

DOK
+2  A: 

For a webapplication which does more than just processing a single contact form or a guestbook form (for which PHP is easier/faster), Java/JSP is surely a good choice. If you refrain yourself from writing scriptlets in JSP and use taglibs/EL in JSP only, then JSP will less or more automatically force you to write webapplications the MVC way, which is after all much better than having it all in one large and unreadable mixed-up procedural file like you see often in PHP. In a Servlet class which you can use to control/preprocess/postprocess requests from/to JSP files, you have the entire freedom to access/call/invoke any Java class/method which is available in the classpath.

Oh, I should add, Google Search uses JSP/Servlet under the hood. I think this is a very strong example of "who uses it".

BalusC
+1  A: 

Java is a sound basis for web applications but you shouldn't use JSPs anymore (at least not directly). Chose a framework which hides the ugly details from you. I suggest that you take a week and implement a simple example using these frameworks:

to find out which suits you development style best.

If you aren't forced to use Java, try TurboGears and Django. They are much more friendly to new users and do a lot of work behind the scenes.

Aaron Digulla
+1  A: 

If your applications will be very data-centric (user updates values in DB, fills in forms, etc.), then I would recommend looking into JSF 2.

With Java EE 6 (which includes JSF 2), you get some extremely powerful features and a majority of the annoyances with JSF 1.x are fixed.

The RI for Java EE 6 is Glassfish v3.

You can learn alot more about JSF at javaserverfaces.org

Zack
A: 

I am a reformed user of Java for everything and I would like to recommend Ruby on Rails. I don't think Ruby is the ideal solution for all problems (nor was Java a terrible choice that should now be shunned). I just think that each one has its strengths and Rails is definitely stronger for web apps.

Rather than just state that as an opinion, let me give a variety of reasons I think that:

1) Structured directories for development (each thing like the models/view/controllers, unit tests, third party plugins, CSS, JavaScript, etc., etc.) has its place in the directory structure. That makes it easier for you to learn the system, it makes it easier for Rails to know what things are without your having to configure them (no plethora of XML config files), and it makes it easier for you to understand other Rails code when you look at it. Think about the last Java code you downloaded from someone, where was everything? If they didn't have an Ant script did you even have a starting place?

2) Realism. By realism I mean a realistic view of what real web development is. It is iterative, databases change, code changes, and you have multiple development environments you regularly work within (for example, development, test, and production). Rails accommodates that from minute one. There are separate configurations for your different environments as well as database migrations to allow you to move your data forward just like your code.

3) Third party support. When I was struggling to build an older version of one of my sites a while back under Java, I kept being stymied by a lack of code I could embed to do basic stuff like giving me tagging for my objects. I don't want to build that code, 500 people have built it before me, let me just get one and use it. But it just wasn't available. Nor was there plugin code for voting, rating things, authentication (and don't start with me about crap like JAAS, that's complete overkill for 80% of all sites), etc.

4) Opinion. I love that the authors made choices and had opinions. Java is all about having 40 options for a MVC framework and 10 more for a ORM solution. Rails is about them having made one good choice for both of them and you've got an excellent starting point. If at some point the site you build grows big enough to require a different solution or you just don't like the stock one, then you can replace it but in the meantime it's a complete solution for all of your needs and it's ready to go five seconds after you type "rails ".

I could go on but at this point it's starting to be gushing. I really encourage you to look at the material at the Ruby on Rails site, PeepCode.com, and RailsCasts.com. They will give you an idea of the tons of great tutorial info available on video and that's ignoring the multitude of books and blog material out there as well.

P.S. I forgot to mention it, but JRuby is a popular solution for running Ruby on Rails web apps and then you can leverage any existing knowledge you might have about Java servers like Glassfish, etc.

John Munsch
Java has a HUGE amount of 3rd-party libraries, and is especially strong on the open-source front.
John
Absolutely no argument on the open source front and there are lots of libraries. But name the plugin to do any of the things I named for your web application if you would. I would contend that you cannot (or at least that you couldn't a year or two ago). If tagging, rating, etc. have showed up in the interim then it's a new thing.The code to just plugin bits and pieces of your web functionality just seems to be missing on the Java side.
John Munsch
A: 

I would strongly recommend looking around in your immediate vicinity for a person experienced with this, and ask his/her opinion! A mentor is a good thing when starting out in completely new environment, and the person you find will most likely also be able to help you with the approach they can recommend.

If you do not have one immediately around, consider hiring a consultant to get startet. You will need sound descisions to build on and doing this WILL save you time and money in the long run. It is rather tedious rewriting an application just because you find that keeping state in the browser is unacceptable for your new client, or a core library isn't threadsafe.

Thorbjørn Ravn Andersen