Unfortunately, if you want to write Java code professionally, you will need to read several books. This is due to two factors. The Java technology is stack is DENSE. Second, since Java is primary deployed in the enterprise, you will need to be exposed (in short order) to Design Patterns, UML, Test-Driven Development, Refactoring, etc. You may be able to pick up the second after you get your first job, but most Java jobs will expect you to know (at a minimum) the Servlet/JSP APIs, JDBC, and some MVC framework. Most will add quite a bit more. It's not impossible to find a Java programming gig, but you have a few bridges to cross first.1.
Learn the Java language:
Thinking in Java by Bruce Eckel2.
Older editions are available online for free. The newest version is available in it's entirety in print.
Eckels also has a DVD of his Hands On Java Seminar for $50. It's the best Java CBT course (next to Oracle's/Sun's courses). It's also MUCH more affordable. It ties into the book very well. I recommended it to a friend and he used both the book and CD to learn Java.
Other suggestions include:
O'Reilly's Java ______ in a Nutshell
The whole series (with the exception of Enterprise Java in a Nutshell) is pretty good. If you learn by doing, Java Examples in a Nutshell might be a good start.
SCJP Sun Certified Programmer for Java 6 Exam by Kathy Sierra and Bert Bates
I personally found this book helpful. It fills in the gaps with terse, yet authoritative information.
Learn how to make a web application without a framework:
My suggestions include:3.
Pro JSP by Simon Brown, Sam Dalton, Sing Li, and Daniel Jepp
A terse, complete tutorial on Servlet, JSP, JSTL, etc technology. It covers everything a beginning developer needs to learn about writing a web application short of a MVC framework tutorial.
Murach's Java Servlets and JSP by Andrea Steelman and Joel Murach
This is the best 'long' introduction to the building simple web applications with Java If you need your hand held, this is the way to go.
Core Servlets Vol. 1 and 2 by Marty Hall
The series is a classic reference and they are both available for free online at http://books.coreservlets.com/
Learn a framework
My suggestion is that you learn Spring MVC framework. To be honest, I'm trying to pick up Spring myself right now. I've worked with Struts 1 and 2. So I don't have as much experience suggesting books for this. However, I've found the following book to be quite helpful.4.
Spring in Action by Craig Walls
Learn how to build and deploy your applications
The build tools:5.
You will want to eventually learn how to build, package, and deploy your applications.
Ant in Action by Steve Loughran and Erik Hatcher
(You will want to probably glance at a book on Maven as well.)
Learn about EJBs6.
UML Demystified by Paul Kimmel
UML Distilled by Martin Fowler
Refactoring by Martin Fowler
Head-First Design Patterns by Elisabeth and Eric Freeman
I understand this is a long list. The problem is that there are so many entities that contribute to the Java community. It adds to the confusion. It isn't unheard of for a Java web app to use several frameworks, libraries, custom tags, etc. I could have added books on Java FX and Flash 'thin-clients', Hibernate (a object relational mapper), books on app servers and servlet containers, etc. However, if you can build a simple web application (without EJBs) with a framework, that may be enough to get you your first gig.