280 likes | 527 Views
An Environment for Java Servlet & JSP Development ~ Apache Tomcat ~. Basic Setup Steps. Download & Install Java S/W Development Kit Download a server (Apache Tomcat) Configure the server Set up development environment Test your setup Establish a deployment method
E N D
An Environment for Java Servlet & JSP Development~ Apache Tomcat ~
Basic Setup Steps • Download & Install Java S/W Development Kit • Download a server (Apache Tomcat) • Configure the server • Set up development environment • Test your setup • Establish a deployment method • Create custom Web applications
Install Instructions • Get & install 5.5.15 Core Windows Executable (apache-tomcat-5.5.15.exe) • Configuration • Port? (8080 or 80) • User: admin • Password: webtech
Set Path to the Installed JVM(Tomcat 5.5 is designed to run on J2SE 5.0 and later.)
What’s Running on Port 80? • IIS • Apache HTTP Server • Tomcat • May need to shut-down other servers or services prior to starting Tomcat. • Start/Control/Administrative Tools/Services • Select the service, properties, set to Manual
Test Install - HTML, JSP, Servlets • Need to test • Static HTML • JSP • Servlets • Test files provided • Testing.html, Testing.jsp, TestingServlet.java • Use default setting (webapps/ROOT)
Servlets – TestingServlet.java • Must be compiled, put in appropriate directories, and referenced correctly.
Check Java 2 Installation & Path(will compile from command line) >java –version >javac –help
If NOT? • Need to install SDK (http://java.sun.com) • Later versions use JRE only (+ Eclipse’s compiler included) • Path env var may be needed c:\Program Files\Java\jdk1.5.0_04;c:\Program Files\Java\jdk1.5.0_04\bin;
CLASSPATH Environment Variable .;C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar; C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\jsp-api.jar
Additional Server Configuration • Enable invoker servlet • Eliminates need for deployment descriptors • Handy during development • Turn on servlet reloading • Checks if servlet has been modified and will be reloaded • Handy during development
Enable Invoker Servlet • Can run servlets without modifying deployment descriptor • Allows you to just drop compiled servlets into WEB-INF/classes directory • Modify $CATALINA_HOME\conf\web.xml • Uncomment 2 elements (servlet & servlet-mapping) • Use URL http://localhost/servlet/ServletName
Servlet Reloading • Turn on servlet reloading • Ck if has been modified since last load • Off by default for production • Modify $CATALINA_HOME\conf\context.xml <Context reloadable=“true”> • Backup prior to changing