The aim of this thread is to gather useful information in regards of Java web development. If you know some tips and tricks, tutorials or any interesting links that has not been already mentioned in previous posts please share with us (please always check to avoid double posting).
Please DO NOT post questions in this thread and also to not post any links leading to websites associated with you as this will goes against forum policies.
What you need for Java web development:Some previous Java knowledge, if you don't know Java you better start reading Starting "Java" [Java tutorials / resources / faq]
Installation of Java (instructions here)
Installation of either Java web server also know as J2EE server(JBoss, WebLogic, WebSphere) or web container (Tomcat, GlassFish) - [Quick jump to post here]
Access to database (MySQL, Oracle, HSQLDB etc.) - [Quick jump to post here]
Optional tools (Ant, Maven, Subversion) - [Quick jump to post here]
Your favourite IDE (IntelliJ IDEA, Eclipse, NetBeans, etc.)
Installing Java
Ubuntu
Install
sudo apt-get install sun-java6-jdk
Java is installed under /usr/lib/jvm/java-6-sun-1.6.0.15 (version number 1.6.0.15 my change over time)Note please that there been some changes in recent release of Ubuntu 10.04. To install Java you need first make changes in repositories as follows before you can run above installation command
sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”
sudo apt-get update
Set environment variable
Many tutorials on the internet will tell you that to set environment variable you need to only type EXPORT command followed by variable name and a path associated with it in your command line/terminal, but they fail to mention that this is only temporary measurement. To make your environment variable permanent in your system you need to edit bashrc file.
sudo gedit ~/.bashrc
//add at the end of the file
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.15
export PATH=$PATH:$JAVA_HOME/bin
Test
java -version
echo $JAVA_HOME
echo $PATH
Windows XP
Download latest installation package from here at the time of writing this entry it was JDK 6 Update 17. Double click and follow installation instructions (may want to uncheck the option for installing additional tool bars for browsers).
Set environment variables
Start > Control Panel > System or just press Window key(left down between Ctrl and Alt) + Pause/Break(up right at the end of F1-F12 row) and you will get System properties window. Here select Advanced tab followed by Environment Variables button. In system variables you should already have existing entry for PATH so click Edit and append ;C:\Program Files\Java\jdk1.6.0_16\bin pressOK. Now press New and in Variable name type JAVA_HOME and in Variable value type C:\Program Files\Java\jdk1.6.0_16 and press OK.
Test
java -version
echo %JAVA_HOME%
echo %PATH%
BOOKS Head First Servlet & JSP (2nd Edition) is great place to start. It will not show you how to build killer web applications, but it will provide will solid understanding of the basic need to successfully start development of web applications. This book is also recommended reading as part of preparation for Sun Certified Web Component Developer ( SCWCD )
Pro JSP 2 is another great book that will show you some additional Java web technologies like JSTL, JSF and Struts. Plus on top of that you have opportunity to learn something about security, performance, scalability and some recommendations of best practices
For fast learners there is also Beginning JSP, JSF, and Tomcat Web Development: From Novice to Professional
If you have already some knowledge of JSP and servlets you may want to broad your general knowledge of web frameworks have look at Art of Java Web Development: Frameworks and Practices
Starting Struts 2 (if you register with InfoQ)
Online Your First Cup: An Introduction to the Java EE Platform , very fast introduction by Sun (may not be suitable for everyone)
The Java EE 6 Tutorial, Volume I is full web development tutorial provided by Sun that will take you trough various topics (The Web Tier, Web Services, Enterprise Beans, Contexts and Dependency Injection for the Java EE Platform, Persistence, Security and Java EE Supporting Technologies). This very extensive reading.
javapassion.com provides access to numerous free courses related to Java or technologies that can be used alongside of Java
coreservlets.com These training materials are based on Marty's books Core Servlets and JavaServer Pages, More Servlets and JavaServer Pages, and Core Web Programming, and various online tutorials and conference talks.
IBM technical library
Hibernate - Getting Started
HIBERNATE - Relational Persistence for Idiomatic Java
Hibernate Reference Documentation
Apache Struts
Developing a Spring Framework MVC application step-by-step