Getting Started with Java Web Development

If you come from another web language such as PHP and you are willing to learn java as a web development language, you may encounter some difficulties. The ammount of different java frameworks and techniques for java web development is overwhelming. In order to put order into the mess, here are some steps that every beginner should do in order to excel with java on the web.

1. Know what an application server is

Differently than PHP and other scripting languages, Java code is compiled into bytecode and deployed to an application server. In other words, you will create your code, compile it, put everything into a compressed file, called a WAR file, and send it to the server.

The deployment keyword may be new for PHP developers.

Therefore, most of the time, you won’t have a htdocs folder where you can just put your code and it will run, like you have on Apache http server. Instead, you may have a webapp folder where you can throw in the WAR file, or you may have to use a web interface to upload your WAR file to the server. It will all depend on which application server you will use.

Here are some of the most popular application servers:

2. Learn Servlets

All the java web frameworks and application servers share on thing in commom: servlets.

Servlets are nothing more than classes that handle http request and response. Once you’ve mastered servlets, you will have a broad idea how to develop most web applications in java, and will understand some of the key concepts of java web developing.

Some good servlet tutorials:

3. JSP

Before jumping in into a framework, it is always good to take a look at JSP. It’s more similar to PHP than pure servlet programming, and will help you get started with coding actual pages.

JSP tutorials:

4. Create an app with JSP and Hibernate

Hibernate is the most popular database framework for java, and it is used widely on web applications. It is a Object-Relational mapping framework, which simply means that you will mostly deal with actual objects rather than database queries. It can connect to various databases such as MySQL, PostgreSQL and Oracle. However, one may find the xml configuring files a bit confusing at first.

The best way to learn hibernate is to build an app using it along JSP. Try to build something simple, like a little blog system or even a one page CRUD (Create,Read,Update,Delete) page that manages one table on a database.

Once you master all the xml file configuration, I would suggest taking a look at hibernate annotations. They make life a lot easier, letting you put field relationships definitions on the actual class source code, instead on a separate xml file.

Hibernate tutorials:

4. Pick a Java Web Framework

Java web frameworks are, at least as far as i know, built on top of servlets, and make life a lot easier. This is probably the most chalanging part for a newcoming java web programmer. The list of java web frameworks is very extensive, and it can be hard to pick the best tool for the job. Here are three of the most popular frameworks:

5. Learn enterprise stuff, if you need it

Keep in mind that, eventhough web development in java may be confused with enterprise development, both are separate things. Web development are the tecniques above, while enteprise development is mostly EJB related.

EJBs, or Enterprise Java Beans, make it possible to put your database entities and code logic in one server, and presentation in another. You don’t really need it if you are just developing websites.

On the other hand, if you work for a business and need to develop application that will run on several different media (mobile, browser, terminal..) EJBs, and JEE in general may come in handy. Keep in mind that, in order to run EJB, one needs an application server that supports EJB.

For more information on EJBs, take a look at:

6 Comments so far »

  1. Eddie Paz said,

    Wrote on September 29, 2008 @ 8:53 am

    This is about the most comprehensive summary about Java technologies I’ve seen. I’ve been learning Java for a while and I have to say that due to the amount of options, it is extremely hard for a beginner to know where to go.

    I’m definitely sending your link to my team. We are making a move to Java as a standard (we currently use only MFC), and they’re finding it hard to get started with the web stuff. Thanks!

  2. Shiller said,

    Wrote on September 29, 2008 @ 2:44 pm

    nice blog, do you recommend any books on Java for a new programmer?

  3. Schlauchboot said,

    Wrote on November 28, 2008 @ 1:21 am

    Hey! I like your post “ng Started with Java Web Development” so well that I like to ask you whether I should translate into German and linking back. Answer welcome. Greetings Schlauchboot

  4. Zubin said,

    Wrote on December 13, 2008 @ 1:34 pm

    I really need video tuts..

  5. Getting started with java web programming | keyongtech said,

    Wrote on January 18, 2009 @ 5:19 pm

    [...] I’ve written a short tutorial on how to start programming java web applications easily on my blog: http://www.leo-sa.com/?p=10 I would like some review from the community on how to improve that further, and hopefully that [...]

  6. webseite erstellen said,

    Wrote on April 7, 2010 @ 3:32 pm

    I studied the html tutorial and I really learned a lot. I think my next homepage will be a lot better than my first one.

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment: