100 likes | 282 Views
Request-Response Cycle. C:myjspapp /chapter01/sample00.htm. Local feedback Loop address. http://localhost:8080/ myapp /chapter01/sample00.html. Tomcat server. browser. requested page returned. page displayed. Tomcat Server. Start Server. Request. http://. localhost. :8080/. myapp.
E N D
Request-Response Cycle C:myjspapp/chapter01/sample00.htm Local feedback Loop address http://localhost:8080/myapp/chapter01/sample00.html Tomcat server browser requested page returned page displayed
Tomcat Server Start Server Request http:// localhost :8080/ myapp /chapter01/sample00.html protocol is http Server is local Path to file Listens on port 8080 Context defined in Tomcat configuration file
To Start Server Start menu > Program Files >Apache Tomcat 4.0 or use: Tomcat-start-shortcut - on desktop or go to: C:\Program Files\Apache Tomcat 4.0\bin and double-click startup.bat
Tomcat Installation Environment variables help system find things – like Java compiler Configuration file helps Tomcat find things and handle file extensions properly, etc
Tomcat Installation Make sure: Environment variables are defined right. Java is installed. Java version numbers in environment variables match your Java version (like 1.4.0) - even if they differ from Xue Bai
Tomcat Installation Precautions: Path variable - copy it to NotePad (and print) before changing it. - Edit in NotePad copy & check carefully –paste carefully ClassPath variable - add new/editper Xue Bai - include "current directory" in ClassPath .; – dot followed by semi-colon. Context path - add new entry to Tomcat configuration file per Xue Bai Don't skip steps in Xue Bai directions - read precisely – read all pages.
Environment variables They tell the system where to find things Control panel > System > Advanced > System variables Double-click variable name to edit.
semi-colon ! -- no spaces Environment Variables --------c:\j2sdk1.4.0\bin;-------- Path - edit it to include because that's where my Java is located. c:\j2sdk1.4.0\ JAVA_HOME - add newvariable with value: yep! ClassPath - add New/edit variable - see Xue Bai - include "current directory" in ClassPath .; – dot followed by semi-colon.
Request: http:// localhost :8080/ - Tells Apache where to find things. TextPad Configuration file C:\Program Files\Apache Tomcat 4.0\conf "server.xml" or: Start menu > programs > Apache >Configuration > edit Right after: <!-- <Context path="" docBase="ROOT" debug="0"/> --> Pick a name Server looks for files here Insert: <Context path="/myapp" docBase="c:\myjspapp" debug="0" privileged="true"/> myapp /chapter01/sample00.html Server Looks in: c:/myjspapp/chapter01/sample00.html
Request: Request: http:// http:// localhost localhost :8080/ :8080/ myapp /chapter01/sample00.html Server looks in c:/myjspapp If add myapp to configuration: Store your files in: c:/myjspapp/chapter01/ If don't add myapp to configuration file (alternatively): Store your files in: C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\chapter01 chapter01/sample00.html no myapp or anything else Server looks here