FAQ for Project

Q: If I want to test the code from the book.. (the first ex. of ch.9) I understand there is a .java file and then a .html file? Now my question is, where do I put/save those files?? and how do associate that with tomcat?? where do I begin?

A: The text describes where to put files. You can also see the structure that is required by looking at the examples that come with Tomcat. The way it associates files with Tomcat is most easily seen when you run the Tomcat http server which listens to port 8080. That server has the Tomcat service plugged in. It expects html files to be located under the webapp folder. So, for example if you try to run http://localhost:8080/examples/Project.html, you would place Project.html in the examples subfolder of the weapps folder. webapps itself is located directly under the Tomcat folder. “.java” files would not be very interesting, as they would display as text. The “.class” files are the ones you typically want to reference. The classes that represent servlets are placed in the folder WEB-INF/classes under examples. This area is then referred to as http://localhost:8080/examples/servlet/HelloWorldExample, if you are managing your services under the examples folder. The name “examples” used here is just an example. We will set up areas on one of my servers that you students can use in your projects. They will be named according to the name you choose for your project. Now, it is necessary to tell the Tomcat system to load the servlets from your examples folder. That is done in the Tomcat manager. I will show this in class on next Wednesday.The text describes where to put files. You can also see the structure that is required by looking at the examples that come with Tomcat. The way it associates files with Tomcat is most easily seen when you run the Tomcat http server which listens to port 8080. That server has the Tomcat service plugged in. It expects html files to be located under the webapp folder. So, for example if you try to run http://localhost:8080/examples/Project.html, you would place Project.html in the examples subfolder of the weapps folder. webapps itself is located directly under the Tomcat folder. “.java” files would not be very interesting, as they would display as text. The “.class” files are the ones you typically want to reference. The classes that represent servlets are placed in the folder WEB-INF/classes under examples. This area is then referred to as http://localhost:8080/examples/servlet/HelloWorldExample, if you are managing your services under the examples folder. The name “examples” used here is just an example. We will set up areas on one of my servers that you students can use in your projects. They will be named according to the name you choose for your project. Now, it is necessary to tell the Tomcat system to load the servlets from your examples folder. That is done in the Tomcat manager. I will show this in class on next Wednesday.