SlideShare a Scribd company logo
1 of 19
Download to read offline
Tomcat and Servlets 
HaifengLiu
Tutorial Overview 
„Tomcat Overview 
„Setting Up and Running Tomcat on CDF 
„Installing and Running Servletson CDF 
„Setting up SysdeoEclipse Tomcat Launcher plugin 
„FAQ?
Tomcat Overview 
„Tomcatis the servletcontainer 
„History: 
‰ASF: JServ–performance 
‰Sun: ServletEngine --specification 
„Requirements and Quality Goals: 
‰Strict adherence to Sun’s JSP/Servletspecification, Interoperability, Modifiability, Performance, Scalability, High-Availability, Security, … 
---Jakarta Tomcat
Tomcat System
Setting Up Tomcat on CDF 
„Status: Installed with user privileges in 
/u/csc309h/lib/brad/tomcat-5.0.27 
„Step 1 –go to website, read instructions 
http://www.cs.toronto.edu/~delara/courses/csc309/resources/csc309guide.html#WebServer 
„Step 2 –download the tar file tomcat.tar.gz 
„Step 3 –untarit (tar xvztomcat.tar.gz) and copy the files into a working directory which is referedas 
e.g. ~/csc309/ 
„Inside tomcat: 
Bin, conf, logs, webapps, work
Start Tomcat Server 
„Step 1 --cd~/csc309/tomcat/bin 
„Step 2 --Run the script start.sh(may need to chmoda+x*.sh) ./start.sh 
„Step 3 --Enter the port number. Tomcat will use 3 ports, the number entered and the next two (e.g., if you are assigned port 32000, tomcat will use 32000, 32001, 32002). 
„Step 4 –check /bin/ps-ef| grepyour_user_id 
„Step 5 –view http://localhost:your_port_number
Stop Tomcat Server 
„To stop your server, run bin/stop.sh. 
„Always remember to stop your server before logging off CDF.
Directory Structure 
„Bin –Startup/shutdown scripts and other useful files. 
„Conf –Configuration files, including modules.xml, server.xml, and a number of apps-<name>.xml. 
„Logs –event log file for each day 
„Webapps–web application files 
„Wok --intermediate files (such as compiled JSP files) during its work. If you delete this directory while Tomcat is running you will not be able to execute JSP pages!
Installing and Compiling Servlets 
„Step 1 --Download the sample files, untarit, put into webapps 
„Step 2 --Compile the Java class 
‰Include the following jar file in your CLASSPATH 
/u/csc309h/lib/tomcat-5.0.27/common/lib/servlet-api.jar. 
setenvCLASSPATH ${CLASSPATH}: /u/csc309h/lib/tomcat- 
5.0.27/common/lib/servlet-api.jar 
‰cd~/csc309/tomcat/webapps/csc309/WEB-INF/classes 
‰Compile the servletjavacHelloWorld.java 
„Step 3 --Start Tomcat 
„Step 4 –Start Browser: 
http://127.0.0.1:yourPortNumber/csc309/servlet/HelloWorld
HelloWorldInterface
Adding a Servletto a Web Application 
„Step 1 –Download PrintEnv.javaand copy it to ~/csc309/tomcat/webapps/csc309/WEB-INF/classes 
„Step 2 --Compile PrintEnv.java 
„Step 3 –Add the following entries to the application descriptor located at ~/csc309/tomcat/webapps/csc309/WEB-INF/web.xml. 
<servlet> 
<servlet-name>PrintEnv</servlet-name> 
<servlet-class>PrintEnv</servlet-class> 
</servlet> 
<servlet-mapping> 
<servlet-name>PrintEnv</servlet-name> 
<url-pattern>/servlet/PrintEnv</url-pattern> 
</servlet-mapping> 
„Step 4 --Restart Tomcat 
„Step 5 –Open browser to http://127.0.0.1:yourPortNumber/csc309/servlet/PrintEnv
PrintEnvInterface
SysdeoEclipse Tomcat Launcher plugin 
„Starting, stopping and restarting Tomcat 4.x, 5.0.x, 3.3 
„Registering Tomcat process to Eclipse debugger 
„Creating a WAR project (wizard can update server.xmlfile) 
„Adding Java Projects to Tomcat classpath 
„Setting Tomcat JVM parameters, classpathand bootclasspath 
„Exporting a Tomcat project to a WAR File 
„Choosing Tomcat configuration file 
„Capability to use a special Tomcat classloaderto have classes in several java projects loaded at the same classloaderlevel than classes in a Tomcat project, see readmeDevLoader.html(Thanks Martin Kahr)
Software Prerequisite 
„Tomcat Server – ”http://jakarta.apache.org/tomcat/” 
„Eclipse 3.X – “http://www.eclipse.org/downloads/index.php” 
„SysdeoEclipse tomcat Launcher plugin-- 
”http://www.sysdeo.com/eclipse/tomcatPlugin. 
html”
Setup Tomcat in Eclipse 
„Enable tomcat 
‰Go to the menu "Window-> Preferences" 
‰go to "Tomcat" and select your Tomcat version 
‰adjust the field "Tomcat Home" to point to the install directory 
„Add a new user 
‰scroll down the menu point "Tomcat" and click the item "Tomcat Manager App" 
‰add a username and a password 
‰click on "Add user to tomcat-users.xml" 
„Test Start Tomcat Server
HelloWorldExample 
„Open a new project 
‰select "Tomcat Project"..., click Next button 
‰call our new project "Hello World" 
‰adjust URI http://localhost:8080/HelloWorld/hello 
„create a new class named HelloServletin the directory WEB-INF/src 
„create the file web.xmlin the directory WEB- INF (Note: not in WEB-INF/src!!!) 
„Start browser "http://localhost:8080/HelloWorld/hello"
HelloServlet 
importjava.io.*; 
importjavax.servlet.http.*; 
importjavax.servlet.*; 
publicclass HelloServletextends HttpServlet{ 
publicvoid doGet(HttpServletRequestreq, 
HttpServletResponseres) throws ServletException, 
IOException{ 
PrintWriterout = res.getWriter(); 
out.println("Hello, Brave new World!"); 
out.close(); 
} 
}
Web.xml 
<!DOCTYPE web-app PUBLIC 
'-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 
'http://java.sun.com/dtd/web-app_2_3.dtd'> 
<web-app> 
<servlet> 
<servlet-name>hello</servlet-name> 
<servlet-class>HelloServlet</servlet-class> 
</servlet> 
<servlet-mapping> 
<servlet-name>hello</servlet-name> 
<url-pattern>/hello</url-pattern> 
</servlet-mapping> 
</web-app>

More Related Content

What's hot

Creating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantCreating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantArtefactual Systems - AtoM
 
Integration of apache with tomcat
Integration of apache with tomcatIntegration of apache with tomcat
Integration of apache with tomcatCognizant
 
Integrating open am with liferay portal
Integrating open am with liferay portalIntegrating open am with liferay portal
Integrating open am with liferay portalprabakaranbrick
 
Architecting Large Enterprise Java Projects
Architecting Large Enterprise Java ProjectsArchitecting Large Enterprise Java Projects
Architecting Large Enterprise Java ProjectsMarkus Eisele
 
Information on Tomcat in cPanel & WHM
Information on Tomcat in cPanel & WHMInformation on Tomcat in cPanel & WHM
Information on Tomcat in cPanel & WHMHTS Hosting
 
Comprehensive Information on Tomcat
Comprehensive Information on TomcatComprehensive Information on Tomcat
Comprehensive Information on TomcatHTS Hosting
 
Glassfish Web Stack Launch Jyri Virkki V2
Glassfish Web Stack Launch Jyri Virkki V2Glassfish Web Stack Launch Jyri Virkki V2
Glassfish Web Stack Launch Jyri Virkki V2Eduardo Pelegri-Llopart
 
플랫폼 통합을 위한 Client Module 개발 & 배포
플랫폼 통합을 위한 Client Module 개발 & 배포플랫폼 통합을 위한 Client Module 개발 & 배포
플랫폼 통합을 위한 Client Module 개발 & 배포흥래 김
 
Installation of Dspace in Windows OS: A Complete Documentation
Installation of Dspace in Windows OS: A Complete DocumentationInstallation of Dspace in Windows OS: A Complete Documentation
Installation of Dspace in Windows OS: A Complete DocumentationAshok Kumar Satapathy
 
How to install laravel framework in windows
How to install laravel framework in windowsHow to install laravel framework in windows
How to install laravel framework in windowsSabina Sadykova
 
Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box
Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box
Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box Tejas Pillai
 
Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Conrad Cruz
 
Aeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringAeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringConrad Cruz
 
How to install ReactJS software
How to install ReactJS software How to install ReactJS software
How to install ReactJS software VigneshVijay21
 

What's hot (20)

Creating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantCreating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with Vagrant
 
Auxiliary : Tomcat
Auxiliary : TomcatAuxiliary : Tomcat
Auxiliary : Tomcat
 
Integration of apache with tomcat
Integration of apache with tomcatIntegration of apache with tomcat
Integration of apache with tomcat
 
Tomcat next
Tomcat nextTomcat next
Tomcat next
 
Integrating open am with liferay portal
Integrating open am with liferay portalIntegrating open am with liferay portal
Integrating open am with liferay portal
 
Apache tomcat
Apache tomcatApache tomcat
Apache tomcat
 
Architecting Large Enterprise Java Projects
Architecting Large Enterprise Java ProjectsArchitecting Large Enterprise Java Projects
Architecting Large Enterprise Java Projects
 
Information on Tomcat in cPanel & WHM
Information on Tomcat in cPanel & WHMInformation on Tomcat in cPanel & WHM
Information on Tomcat in cPanel & WHM
 
Devopstore
DevopstoreDevopstore
Devopstore
 
Comprehensive Information on Tomcat
Comprehensive Information on TomcatComprehensive Information on Tomcat
Comprehensive Information on Tomcat
 
My SQL 1
My SQL 1My SQL 1
My SQL 1
 
Glassfish Web Stack Launch Jyri Virkki V2
Glassfish Web Stack Launch Jyri Virkki V2Glassfish Web Stack Launch Jyri Virkki V2
Glassfish Web Stack Launch Jyri Virkki V2
 
플랫폼 통합을 위한 Client Module 개발 & 배포
플랫폼 통합을 위한 Client Module 개발 & 배포플랫폼 통합을 위한 Client Module 개발 & 배포
플랫폼 통합을 위한 Client Module 개발 & 배포
 
Installation of Dspace in Windows OS: A Complete Documentation
Installation of Dspace in Windows OS: A Complete DocumentationInstallation of Dspace in Windows OS: A Complete Documentation
Installation of Dspace in Windows OS: A Complete Documentation
 
JBoss Snowdrop
JBoss SnowdropJBoss Snowdrop
JBoss Snowdrop
 
How to install laravel framework in windows
How to install laravel framework in windowsHow to install laravel framework in windows
How to install laravel framework in windows
 
Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box
Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box
Accessing Oracle 11 g on Mac OS (10.7.5) using Oracle Virtual Box
 
Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)
 
Aeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringAeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filtering
 
How to install ReactJS software
How to install ReactJS software How to install ReactJS software
How to install ReactJS software
 

Viewers also liked

Java build tool_comparison
Java build tool_comparisonJava build tool_comparison
Java build tool_comparisonManav Prasad
 
Java Build Tool course in 2011
Java Build Tool course in 2011Java Build Tool course in 2011
Java Build Tool course in 2011Ching Yi Chan
 
2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(3)-フォルダ構造、マネージャツール
2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(3)-フォルダ構造、マネージャツール2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(3)-フォルダ構造、マネージャツール
2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(3)-フォルダ構造、マネージャツールEnpel
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and AntDavid Noble
 
JBoss Application Server 7
JBoss Application Server 7JBoss Application Server 7
JBoss Application Server 7Ray Ploski
 
WebLogic Deployment Plan Example
WebLogic Deployment Plan ExampleWebLogic Deployment Plan Example
WebLogic Deployment Plan ExampleJames Bayer
 
Weblogic configuration & administration
Weblogic   configuration & administrationWeblogic   configuration & administration
Weblogic configuration & administrationMuhammad Mansoor
 
Where and when to use the Oracle Service Bus (OSB)
Where and when to use the Oracle Service Bus (OSB)Where and when to use the Oracle Service Bus (OSB)
Where and when to use the Oracle Service Bus (OSB)Guido Schmutz
 
Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)
Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)
Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)Guido Schmutz
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)Roman Kharkovski
 
Oracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic ConceptsOracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic ConceptsJames Bayer
 

Viewers also liked (18)

Java build tool_comparison
Java build tool_comparisonJava build tool_comparison
Java build tool_comparison
 
Releasing Projects Using Maven
Releasing Projects Using MavenReleasing Projects Using Maven
Releasing Projects Using Maven
 
Building java projects with maven
Building java projects with mavenBuilding java projects with maven
Building java projects with maven
 
Java Build Tool course in 2011
Java Build Tool course in 2011Java Build Tool course in 2011
Java Build Tool course in 2011
 
2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(3)-フォルダ構造、マネージャツール
2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(3)-フォルダ構造、マネージャツール2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(3)-フォルダ構造、マネージャツール
2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(3)-フォルダ構造、マネージャツール
 
Manen Ant SVN
Manen Ant SVNManen Ant SVN
Manen Ant SVN
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and Ant
 
Jboss Tutorial Basics
Jboss Tutorial BasicsJboss Tutorial Basics
Jboss Tutorial Basics
 
JEE Programming - 07 EJB Programming
JEE Programming - 07 EJB ProgrammingJEE Programming - 07 EJB Programming
JEE Programming - 07 EJB Programming
 
JBoss Application Server 7
JBoss Application Server 7JBoss Application Server 7
JBoss Application Server 7
 
WebLogic Deployment Plan Example
WebLogic Deployment Plan ExampleWebLogic Deployment Plan Example
WebLogic Deployment Plan Example
 
Weblogic configuration & administration
Weblogic   configuration & administrationWeblogic   configuration & administration
Weblogic configuration & administration
 
Oracle Web Logic server
Oracle Web Logic serverOracle Web Logic server
Oracle Web Logic server
 
Where and when to use the Oracle Service Bus (OSB)
Where and when to use the Oracle Service Bus (OSB)Where and when to use the Oracle Service Bus (OSB)
Where and when to use the Oracle Service Bus (OSB)
 
Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)
Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)
Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
 
Oracle OSB Tutorial 1
Oracle OSB Tutorial 1Oracle OSB Tutorial 1
Oracle OSB Tutorial 1
 
Oracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic ConceptsOracle WebLogic Server Basic Concepts
Oracle WebLogic Server Basic Concepts
 

Similar to Tomcat tutorail

Similar to Tomcat tutorail (20)

Apache Tomcat 8 Application Server
Apache Tomcat 8 Application ServerApache Tomcat 8 Application Server
Apache Tomcat 8 Application Server
 
Spring Live Sample Chapter
Spring Live Sample ChapterSpring Live Sample Chapter
Spring Live Sample Chapter
 
Mc sl54 051_ (1)
Mc sl54 051_ (1)Mc sl54 051_ (1)
Mc sl54 051_ (1)
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and Deployment
 
Tomcat Configuration (1)
Tomcat Configuration (1)Tomcat Configuration (1)
Tomcat Configuration (1)
 
bjhbj
bjhbjbjhbj
bjhbj
 
Integrating tomcat with apache
Integrating tomcat with apacheIntegrating tomcat with apache
Integrating tomcat with apache
 
Lect06 tomcat1
Lect06 tomcat1Lect06 tomcat1
Lect06 tomcat1
 
Tomcat server
 Tomcat server Tomcat server
Tomcat server
 
Tomcat Server
Tomcat ServerTomcat Server
Tomcat Server
 
Tomcat + other things
Tomcat + other thingsTomcat + other things
Tomcat + other things
 
Apache
ApacheApache
Apache
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed intro
 
Ta Javaserverside Eran Toch
Ta Javaserverside Eran TochTa Javaserverside Eran Toch
Ta Javaserverside Eran Toch
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Struts2 tutorial
Struts2 tutorialStruts2 tutorial
Struts2 tutorial
 
Struts2 tutorial
Struts2 tutorialStruts2 tutorial
Struts2 tutorial
 
Struts2 tutorial
Struts2 tutorialStruts2 tutorial
Struts2 tutorial
 
Java Servlets & JSP
Java Servlets & JSPJava Servlets & JSP
Java Servlets & JSP
 
Jakarta struts
Jakarta strutsJakarta struts
Jakarta struts
 

Recently uploaded

VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneVIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneCall girls in Ahmedabad High profile
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Roomdivyansh0kumar0
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneCall girls in Ahmedabad High profile
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 

Recently uploaded (20)

VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneVIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 

Tomcat tutorail

  • 1. Tomcat and Servlets HaifengLiu
  • 2. Tutorial Overview „Tomcat Overview „Setting Up and Running Tomcat on CDF „Installing and Running Servletson CDF „Setting up SysdeoEclipse Tomcat Launcher plugin „FAQ?
  • 3. Tomcat Overview „Tomcatis the servletcontainer „History: ‰ASF: JServ–performance ‰Sun: ServletEngine --specification „Requirements and Quality Goals: ‰Strict adherence to Sun’s JSP/Servletspecification, Interoperability, Modifiability, Performance, Scalability, High-Availability, Security, … ---Jakarta Tomcat
  • 5. Setting Up Tomcat on CDF „Status: Installed with user privileges in /u/csc309h/lib/brad/tomcat-5.0.27 „Step 1 –go to website, read instructions http://www.cs.toronto.edu/~delara/courses/csc309/resources/csc309guide.html#WebServer „Step 2 –download the tar file tomcat.tar.gz „Step 3 –untarit (tar xvztomcat.tar.gz) and copy the files into a working directory which is referedas e.g. ~/csc309/ „Inside tomcat: Bin, conf, logs, webapps, work
  • 6. Start Tomcat Server „Step 1 --cd~/csc309/tomcat/bin „Step 2 --Run the script start.sh(may need to chmoda+x*.sh) ./start.sh „Step 3 --Enter the port number. Tomcat will use 3 ports, the number entered and the next two (e.g., if you are assigned port 32000, tomcat will use 32000, 32001, 32002). „Step 4 –check /bin/ps-ef| grepyour_user_id „Step 5 –view http://localhost:your_port_number
  • 7.
  • 8. Stop Tomcat Server „To stop your server, run bin/stop.sh. „Always remember to stop your server before logging off CDF.
  • 9. Directory Structure „Bin –Startup/shutdown scripts and other useful files. „Conf –Configuration files, including modules.xml, server.xml, and a number of apps-<name>.xml. „Logs –event log file for each day „Webapps–web application files „Wok --intermediate files (such as compiled JSP files) during its work. If you delete this directory while Tomcat is running you will not be able to execute JSP pages!
  • 10. Installing and Compiling Servlets „Step 1 --Download the sample files, untarit, put into webapps „Step 2 --Compile the Java class ‰Include the following jar file in your CLASSPATH /u/csc309h/lib/tomcat-5.0.27/common/lib/servlet-api.jar. setenvCLASSPATH ${CLASSPATH}: /u/csc309h/lib/tomcat- 5.0.27/common/lib/servlet-api.jar ‰cd~/csc309/tomcat/webapps/csc309/WEB-INF/classes ‰Compile the servletjavacHelloWorld.java „Step 3 --Start Tomcat „Step 4 –Start Browser: http://127.0.0.1:yourPortNumber/csc309/servlet/HelloWorld
  • 12. Adding a Servletto a Web Application „Step 1 –Download PrintEnv.javaand copy it to ~/csc309/tomcat/webapps/csc309/WEB-INF/classes „Step 2 --Compile PrintEnv.java „Step 3 –Add the following entries to the application descriptor located at ~/csc309/tomcat/webapps/csc309/WEB-INF/web.xml. <servlet> <servlet-name>PrintEnv</servlet-name> <servlet-class>PrintEnv</servlet-class> </servlet> <servlet-mapping> <servlet-name>PrintEnv</servlet-name> <url-pattern>/servlet/PrintEnv</url-pattern> </servlet-mapping> „Step 4 --Restart Tomcat „Step 5 –Open browser to http://127.0.0.1:yourPortNumber/csc309/servlet/PrintEnv
  • 14. SysdeoEclipse Tomcat Launcher plugin „Starting, stopping and restarting Tomcat 4.x, 5.0.x, 3.3 „Registering Tomcat process to Eclipse debugger „Creating a WAR project (wizard can update server.xmlfile) „Adding Java Projects to Tomcat classpath „Setting Tomcat JVM parameters, classpathand bootclasspath „Exporting a Tomcat project to a WAR File „Choosing Tomcat configuration file „Capability to use a special Tomcat classloaderto have classes in several java projects loaded at the same classloaderlevel than classes in a Tomcat project, see readmeDevLoader.html(Thanks Martin Kahr)
  • 15. Software Prerequisite „Tomcat Server – ”http://jakarta.apache.org/tomcat/” „Eclipse 3.X – “http://www.eclipse.org/downloads/index.php” „SysdeoEclipse tomcat Launcher plugin-- ”http://www.sysdeo.com/eclipse/tomcatPlugin. html”
  • 16. Setup Tomcat in Eclipse „Enable tomcat ‰Go to the menu "Window-> Preferences" ‰go to "Tomcat" and select your Tomcat version ‰adjust the field "Tomcat Home" to point to the install directory „Add a new user ‰scroll down the menu point "Tomcat" and click the item "Tomcat Manager App" ‰add a username and a password ‰click on "Add user to tomcat-users.xml" „Test Start Tomcat Server
  • 17. HelloWorldExample „Open a new project ‰select "Tomcat Project"..., click Next button ‰call our new project "Hello World" ‰adjust URI http://localhost:8080/HelloWorld/hello „create a new class named HelloServletin the directory WEB-INF/src „create the file web.xmlin the directory WEB- INF (Note: not in WEB-INF/src!!!) „Start browser "http://localhost:8080/HelloWorld/hello"
  • 18. HelloServlet importjava.io.*; importjavax.servlet.http.*; importjavax.servlet.*; publicclass HelloServletextends HttpServlet{ publicvoid doGet(HttpServletRequestreq, HttpServletResponseres) throws ServletException, IOException{ PrintWriterout = res.getWriter(); out.println("Hello, Brave new World!"); out.close(); } }
  • 19. Web.xml <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'> <web-app> <servlet> <servlet-name>hello</servlet-name> <servlet-class>HelloServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>hello</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> </web-app>