LAB SESSION 2: SERVLETS ======================= 0.- Understand what Servlets are and how they work. A good place to start is: http://www.cse.iitb.ac.in/dbms/Data/Courses/DBIS/Software/servlets/servlet_tutorial.html 1.- Install Tomcat. Download Tomcat from: -> Linux: http://docencia.ac.upc.edu/FIB/PXC/lab/_servlet/jakarta-tomcat-5.0.28.tar.gz Untar the tarball: tar xzf jakarta-tomcat-5.0.28.tar.gz; rm jakarta-tomcat-5.0.28.tar.gz -> MS Windows: http://docencia.ac.upc.edu/FIB/PXC/lab/_servlet/jakarta-tomcat-5.0.28.exe 2.- Set CLASSPATH: bash CLASSPATH=$CLASSPATH:~/jakarta-tomcat-5.0.28/common/lib/servlet-api.jar export CLASSPATH 3.- Start Tomcat: bin/startup-using-launcher.sh 4.- Try the examples in: http://docencia.ac.upc.edu/FIB/PXC/lab/_servlet/p3codigo.tgz 4.a) You have to save the servlets in ~/jakarta-tomcat-5.0.28/webapps/servlets-examples/WEB-INF/classes and compile them 4.b) Save the html pages in ~/jakarta-tomcat-5.0.28/webapps/servlets-examples/. You can access the html pages at http://localhost:8080/servlets-examples/hola.html 5.- Every time you and a new servlet to Tomcat you have to: 5.a) Register each servlet in ~/jakarta-tomcat-5.0.28/webapps/servlets-examples/WEB-INF/web.xml with the following: 8<--- hola hola hola /servlet/hola --->8 5.b) Every time web.xml is modified Tomcat needs to be restarted. 5.c) You can execute the servlet directly with a browser with the following URL: http://localhost:8080/servlets-examples/servlet/hola 6) Implement the same car rental system you did in the previous lab session. But, this time with servlets.