views:

1584

answers:

9

I want to learn, at least at a basic level, how to build java web applications (coming from a .net background).

Meaning, I would like to be able to build, deploy a simple cms type application from the ground up.

What exactly do I need to learn?

Tomcat seems to be a good web server for Java.

What options are there for the web? I know there is hibernate for an ORM.

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

Maybe a book that covers all of these?

+1  A: 

I'm a PHP/C programming and I've found groovy enable to me to jump into Java without learning all the classes and paradigms inherent in java programming. Groovy enabled me to be productive quickly, while taking time to learn more about java and all the tools/frameworks/libraries available.

Mr-sk
+3  A: 

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.

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.

duffymo
you say tomcat does have a web server built in, what else is it then? i thought all it was is a web server?
mrblah
@mrblah - Tomcat is a servlet engine. It was made to process servlet classes (which are what jsp's are turned into) and serve the output to a browser. Along with that, it also serves all regular files (images, html, css, etc) just like a web server does. It is comparable to Apache with a php module.
Nemi
A: 

check this out :

http://mcatr.blogspot.com/2009/09/what-should-new-jee-developers-learn.html

also you should definitely learn jee6 api.

MCA
Java EE 6 is not essential for writing web apps. EJBs are not central to the topic.
duffymo
well it just released and might be a good place to start.
MCA
+24  A: 

What exactly do I need to learn?

I assume that you're already familiar with client side technologies like HTML/CSS/JS, so I'll leave it aside. For the case that, the tutorials at w3schools.com are enough to understand the trivial stuff and as reference and as books I can recommend the "X for Dummies" series like "HTML for Dummies". Have a look at Amazon.com. Also see this answer for an overview of useful links regarding the necessary client side matters. I also assume that you're already familiar with basic Java. Follow the Sun basic tutorials and if possible, go get a SCJP book or course as well.

Then you can start with JSP/Servlet. Good tutorials can be found in the Sun Java EE 5 tutorial part II chapters 1 - 8 and at Coreservlets.com (Beginner/Intermediate and Advanced, also JDBC). Good books for that are the Head First Servlets & JSP and Core Servlets and JSP (older versions of this book are also online available as PDF).

Tomcat seems to be a good web server for Java.

It is. It is however limited in capabilities (it's a simple servlet container, implementing only the JSP/Servlet parts of the Java EE API), if you ever want to go EJB or JPA, then you'd like to pick another, e.g. JBoss AS or Glassfish. JBoss uses Tomcat under its hoods and adds more Java EE capabilities to it. Glassfish is Sun's own complete Java EE implementation.

Two weeks ago, the Java EE 6 came out, which is pretty damn good, but as far now only the Glassfish V3 server supports it. Tomcat 7.0 is still on its way, implementing the greatly improved Servlet 3.0 API, it might take some months however. If you can, I would more recommend to go ahead with Java EE 6, it is a major improvement step as opposed to Java EE 5. Here's an overview of the new features. In the case you'd like to go ahead with JEE6, JSP/Servlet are covered in Java EE 6 tutorial part II chapter 10.

What options are there for the web? I know there is hibernate for an ORM.

You can also use JPA, part of Java EE. You can learn it at Java EE 5 tutorial part V or Java EE 6 tutorial part IV. It's good to know that the guy behind Hibernate (Gavin King) was hired by Sun to do all the JPA works. Hibernate also has a JPA implementation (the EntityManager).

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

The 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. It is been replaced by Facelets. You can still use Facelets in Java EE 5, but you have to install it separately. In Java EE 6, it is included and covered in Java EE 6 tutorial part II chapters 1 - 9. You can by the way also use JSF on Tomcat, you only have to install it separately. Just download the JAR's from the JSF dev homepage and place them in /WEB-INF/lib. Glassfish as being a complete Java EE implementation already ships with JSF.

Maybe a book that covers all of these?

There are several books. I would recommend to start with a book targeted on JSF and eventually also in combination with JPA, however, most of those are still targeted on Java EE 5. Have a look at Amazon.com and ensure that you choose the most recent book covering the subject. Thus not an old book for JSF 1.0 or so. For example the book as suggested by Pascal in the comments below, or a Second Edition which is to be released some months later.

See also:

BalusC
+1 and I recommend this book: http://apress.com/book/view/9781430219545
Pascal Thivent
Thanks, I'll also keep that book in mind.
BalusC
This book from Hanumant Deshmuck is best for getting started for Java web development http://rads.stackoverflow.com/amzn/click/1930110596
Xinus
+4  A: 

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).

alex
A: 

You might want to just take a look at this Stackoverflow question. It may give you a lot of information.

Chris
+1  A: 

Since you are new to Java I would strongly recommend you learn the basic language first. This will help you regardless of what technology you choose to do your web application in.

A good online resource is the Sun Java Tutorial - http://java.sun.com/docs/books/tutorial/

Thorbjørn Ravn Andersen
+1  A: 

Does java have MVC?

Java has different frameworks like Struts2, Spring MVC

what about JSP?

JSP is template library. There are few alternatives you may try like FreeMarker and Velocity. AFAIK Freemarker is a emerging as good template library. Its lightweight than JSP. Check this FreeMarker: An open alternative to JSP - JavaWorld

can MVC and JSP be together?

I take MVC as a framework mentioned previously. All frameworks have support for JSP but you need to check support for other template libraries in respective frameworks documentation. AFAIK Struts2 to has a very good support for Freemarker.

beans?

I do not know much about it. But using beans we can directly map form data to databases.

Maybe a book that covers all of these?

Each framework has its own book. For Struts2 - Struts 2 in Action

String MVC - Take a look at question What are the best books for Spring and Spring MVC ?

Fremarker has a very good documentation - FreeMarker Manual

For getting started to web development in Java -

alt text

http://www.amazon.com/SCWCD-Exam-Study-Kit-Certification/dp/1930110596

Xinus
A: 

I consider most of the traditional Java web development options to be pretty heavy-weight, and there are some good alternatives:

  • Play is an MVC framework which is focused on being lightweight, straightforward, and enabling rapid development — while sticking with pure Java, as opposed to a more dynamic JVM-based language. It's fairly new but already impressive, and a good community has built up around it quickly.

  • Grails is an MVC framework, inspired by Ruby on Rails, which is written in, and uses, Groovy, a Java-based scripting language. Grails is mature, robust, and widely respected, with a strong community. Groovy is basically a superset of Java, with better syntax and some great features such as closures, so learning it is a great way to learn Java.

  • If you need/want to build RESTful web sites/services/applications, Restlet is a fantastic framework — I'm a big fan. It's simple, straightforward, and yet flexible. Great community too.

  • Google's App Engine is an interesting option as well. It's hosted, which may or may not be of interest, but it has a fairly simple API, and a good SDK.

I'm sure there are others, but these are the ones I can think of off the top of my head.

Good luck, and have fun!

Avi Flax
Oh, and I just discovered Prudence the other day: http://threecrickets.com/prudence/
Avi Flax