We start by looking at servlets with sessions. I start by creating a new context (a folder in webapps). So I can do it like this: 1. mkdir $CATALINA_HOME/webapps/0414 2. mkdir $CATALINA_HOME/webapps/0414/WEB-INF 3. mkdir $CATALINA_HOME/webapps/0414/WEB-INF/classes 4. mkdir $CATALINA_HOME/webapps/0414/WEB-INF/lib 5. pico $CATALINA_HOME/webapps/0414/index.html Then I check in person: -bash-3.2$ pwd /u/dgerman/apache-tomcat-5.5.17/webapps/0414 -bash-3.2$ du -a . 8 ./WEB-INF/lib 8 ./WEB-INF/classes 24 ./WEB-INF 8 ./index.html 40 . -bash-3.2$ I can't remember my port number. Where do I look? -bash-3.2$ pwd /u/dgerman/apache-tomcat-5.5.17/webapps/0414 -bash-3.2$ grep 470 ../../conf/* ../../conf/server.xml: ../../conf/server.xml: -bash-3.2$ Now I know I can access my new context like this: http://silo.cs.indiana.edu:47064/0414/ The other way was with Tomcat Manager, set up with tomcat-users.xml file. So now I need to get started writing a servlet. So what am I looking at: a) I will write a file One.java b) I will place it in classes c) I will compile it with javac d) I will remember that that might be version 1.6 e) so I will be careful to compile with $JAVA_HOME/bin/javac not just javac f) I will describe it in a web.xml file - here I can explicitly state how the user will call the servlet - there are three names: 1) what the user calls the servlet (nameOne) 2) what we (the designers) call the servlet internally (nameTwo) 3) the class name (One) - they can be all of them the same (in which case nameOne is One). g) I will place that file in WEB-INF h) I will access it as follows: http://silo.cs.indiana.edu:47064/0414/servlet/nameOne i) I will happily accept any flaws it exhibits at this stage and will try to fix them: edit, re-compile. Now to access it over the web and work with the new updated version of the servlet we need to reload the context. So we write this servlet: import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class One extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession session = request.getSession(); String count = (String) session.getAttribute("count"); if (count == null) count = "0"; else count = (Integer.parseInt(count) + 1) + ""; session.setAttribute("count", count); response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("

" + count + "

"); } } So next time we will deploy, test and debug this.