Good Java Servlet Book?

I would like to learn how to build a webpage using java. There are lots of java books out there but I’m looking for one that specializes on web development. I’ve looked through the Java Resources sticky but it seems out-of-date (2004).

Any suggestions on good books on this subject for someone with a primary background in php but some experience with C#.Net.

These are the current books I’ve found:
http://www.amazon.com/Head-First-Servlets-JSP-Certified/dp/0596516681/ref=pd_sim_b_8

http://www.amazon.co.uk/Head-First-Java-Kathy-Sierra/dp/0596009208/ref=sr_1_2?s=books&ie=UTF8&qid=1297872328&sr=1-2

Thanks.

First things first, with no Java experience/knowledge, trying to jump into Servlets is a one-way ticket to Frustrationville.

Before you can build a tower, you must first know how to build a brick.

That said, the Head First series, in my experience, is informative, complete and fun to work through.

As to servlets/JSP, you’ll need more than Java to accomplish much of anything.

On the front end: HTML, CSS, Javascript/AJAX, JSTL, and JSP are all part of building a GUI people will want to use.

Back end: Servlets (hardly anyone actually uses servlets directly - frameworks are the mode du jour: Struts, Spring, etc - however, to understand what you’re doing with a framework, you will need to understand servlets). Servlet Container: you’ll need a (software) server to provide access and/or test your application, Tomcat is a good choice, there are others.

Storage: Database creation, manipulation and management. If you’re already familiar with a DB, there’s a Java library for it.

I should have been more thorough in my background.

I do have basic understanding of Java Syntax and have lots of experience with OO programming. I’m also very experienced in HTML, CSS, Javascript, Jquery, PHP. And moderately experienced with C#.NET.

What i’m not used to is using a compiled language such as java in a web development environment. I want a book that will not only be a refresher in java programming but will also teach me how to build and structure a Java-based web application. I’ve done some basic modifications to java-based web applications, but I’ve never built one from scratch.

I suppose the biggest difference is the separation of duties: the front-end (JSP, et al) should be pretty but dumb, the back-end does all the work.

At any rate, you won’t find a book that teaches/refreshes Java and covers servlets. A book on servlets will assume you already have a decent grasp on the hows and whys of Java.

So, Head First Java followed by Head First Servlets will get you headed in the right direction. Also, bookmark and learn to effectively use The Java API Specification. Even we gurus (if I may be so bold…) don’t have every class, method and variable memorized.

I honestly feel that this link resource is more than enough to learn Servlets & JSP

http://pdf.coreservlets.com/

It’s probably outdated a bit but the concept of servlets & jsp is very clear.

Also, if you’re thinking of building professional quality Java Web then you need to use MVC Frameworks

MVC Frameworks - Spring MVC/Web Flow, JSF 2.X, Struts 2.X, etc…

Personally I recommend Spring MVC but JSF 2.X is probably more popular skills to learn.

Also, MVC Framework is just a start and you’ll need to seriously think about other frameworks to use

  • Spring Core, Spring Security, JPA (Hibernate), Transaction Framework, and on and on on…

These frameworks ARE not there to make you more confusing but to re-use other people’s code… No need to reinvent the wheel over and over… but I’ve seen many people being too overwhelmed to become Senior Java Developer. If I were you, I’d tackle them one by one. G’luck!