Java EE web development, where do I start and what skills do I need?

(Updated Mar 2020)

First of all, "Java EE" has since Sep 2019 been renamed to "Jakarta EE", starting with version 8. Historically, there was also the term "J2EE" which covered versions 1.2 until 1.4. The "Java EE" covered versions 5 until 8. See also Java Platform, Enterprise Edition, History on Wikipedia.

What exactly do I need to learn?

I assume that you're already familiar with client side technologies like HTML, CSS and JS, so I won't go in detail with that. I also assume that you're already familiar with basic Java. Follow Oracle's The Java Tutorials and if possible, go get a OCP book or course as well.

Then you can start with JSP/Servlet to learn the basic concepts of Java web development. Good tutorials can be found in Oracle's Java EE 5 tutorial part II chapters 3 - 8 and at Coreservlets.com (Beginner-Intermediate and Advanced, also JDBC). Note that since Java EE 6, JSP is removed from the Java EE tutorial in favor of JSF and that JSP has basically not changed since then. That's why you could safely use the fairly old Java EE 5 tutorial for this. Most important thing with regard to JSP is the fact that writing plain Java code in JSP files using <% scriptlets %> is officially discouraged since 2003. See also How to avoid Java code in JSP files? So any tutorials which still cover scriptlets should be skipped as they will definitely take you into a downward spiral of learning bad practices.

Here on Stack Overflow, you can also find nice wiki pages about JSP, Servlets, JSTL and EL where you can learn the essentials and find more useful links.


Tomcat seems to be a good web server for Java.

It is. It is however limited in capabilities. It's basically a barebones servlet container, implementing only the JSP/Servlet parts of the huge Java EE API. If you ever want to go EJB or JPA, then you'd like to pick another, e.g. WildFly, TomEE, Payara, Liberty, WebLogic, etc. Otherwise you have to use Spring instead of Java EE. It's namely not possible to install EJB in a barebones servlet container without modifying the core engine, you'd in case of Tomcat basically be reinventing TomEE. See also What exactly is Java EE?, How to properly install and configure JSF libraries via Maven? and How to install and use CDI on Tomcat?


I know there is Hibernate for an ORM.

Previously, during the J2EE era, when JPA didn't exist and EJB2 was terrible, Hibernate was a standalone framework and often used in combination with Spring to supplant EJB. Since the introduction of JPA in Java EE 5 (2006), Hibernate has become a JPA implementation. You can learn JPA at Jakarta EE tutorial part VIII. Also, EJB3 was much improved based on lessons learnt from Spring. See also When is it necessary or convenient to use Spring or EJB3 or all of them together?


Does Java have MVC? What about JSP? Can MVC and JSP be together? JavaBeans?

You can, but that's a lot of reinvention of the wheel when it comes to tying the model with the view (conversion, validation, change listeners, etc). Java EE's MVC framework is called JSF. Prior to Java EE 6 it used to run on JSP, which is a fairly legacy view technology. JSP is been replaced by Facelets. You can learn JSF at Jakarta EE tutorial part III chapters 7 - 17. You can by the way also use JSF on Tomcat, you only have to install it separately. Installation instructions can be found at Mojarra homepage. WildFly, TomEE, Payara, Liberty, WebLogic, etc as being a complete Java EE implementation already provide JSF (and CDI, BV, JSONP, JAX-RS, EJB, JPA, etc) out the box, so you don't need to install it separately. See also How to properly install and configure JSF libraries via Maven?


Maybe a book that covers all of these?

There are several books. I would recommend to start with a book focused on Jakarta EE in general, a book more focused on JSF, and a book more focused on JPA. Ensure that you choose the most recent book covering the subject. First investigate the most recent available version and then ensure that the chosen book covers that. Thus do definitely not pick an old book for Java EE 5 or JSF 1.0 or so while there's currently already Jakarta EE 8 and JSF 2.3 available.

Last but not least, please ignore code snippet scraping sites maintained by amateurs with primary focus on advertisement income instead of on teaching, such as roseindia, tutorialspoint, javabeat, journaldev, javatpoint, codejava, etc. They are easily recognizable by disturbing advertising links/banners and JSP code snippets containing scriptlets.

See also:

  • What is the difference between JSF, Servlet and JSP?
  • How do servlets work? Instantiation, sessions, shared variables and multithreading
  • What is the need of JSF, when UI can be achieved with JavaScript libraries such as jQuery and AngularJS

What exactly do I need to learn?

Minimally,

  • Java the language
  • Java the API, including JDBC for database access
  • An IDE, or a text editor + Ant
  • Java EE, basically, servlets and JSP
  • A servlet container (such as Tomcat)

Tomcat seems to be a good web server for Java.

It is "decent". If you are not into EJBs, probably you will not need to learn anything else. Glassfish 3 seems to be pretty cool lately, but I have not played with it much yet. Note, it is "more" than a web server. It is a servlet container (meaning it can run apps using servlet technology).

What options are there for the web?

About a zillion different frameworks. Really, choosing one is really "difficult". It is very tempting to try them all, but ultimately unfeasible.

I know there is hibernate for an ORM.

I am somewhat anti-ORM, but Hibernate is what you need if you need a "full" ORM. You can also try "partial" ORMs, such as Spring's JDBC support or iBatis.

Does java have MVC? what about JSP? can MVC and JSP be together? beans?

Yes, most Java web frameworks do MVC. Spring's MVC is nice, but I can't recommend anything else (especially, not Struts 1!). JSP is just an HTML (or XML) templating engine. Old-school JSP, with embedded Java code is uncool; modern JSP with tag files and libraries is pretty good.

I suppose most frameworks will let you use JSP to render your Vs; Spring's MVC and Struts do. Some will let you use something else too (Velocity, Freemarker, etc.).

Beans is just a convention for objects. Basically, it means that you are using getters and setters (or some alternatives) and you are following some rules. These should let your object be manipulated by certain tools. The typical example is a GUI, some tools will let you build GUI components to edit arbitrary beans (i.e. they will render a form to edit its fields).


You need HTML, CSS, and JavaScript - all the usual suspects for web development.

Tomcat does have a web server built in, but it's a servlet/JSP engine. Apache is the pure web server.

You need to learn JSP, which is a templating language for generating servlets that generate HTML output. You'll want to write them using JSTL, not scriptlets.

If you're doing CRUD applications, you'll need to learn JDBC and relational databases. You should do that before trying Hibernate or any other ORM, because it's the foundation on which they're built.

JavaBeans are just standards for Java objects.

If you're up for it, I'd recommend the Spring framework.