Unformatted text preview:

Appendix The Stand Alone Server A free stand alone server can be downloaded from the Apache open software project. It is Tomcat 4.0.4, and it is available from http://jakarta.apache.org/. (It is also in the Documents folder of the website, http://csis.pace.edu/~wolf/. Directions for installation can be found at http://archive.coreservlets.com/Using-Tomcat.html. Make sure that you download the regular version, not the LE version. The latter requires an XML parser and doesn’t work without it. The directions at coreservlets also tell you which directories to use for your html files and Java servlets. The html files should be placed in the webapps/ROOT subfolder of the Apache folder. The servlets class files belong in the webapps/ROOT/WEB-INF/classes folder. If you are reading from a file, the file goes into that folder also. Configuring JCreator The main class of a servlet extends the HttpServlet class. This class is contained in a file called servlet.jar that is available for downloading from SUN. To make things easier for you, it can also be found in the Documents directory of the website found at http://csis.pace.edu/~wolf/. You can download it from there and store it with the other .jar files in the lib subdirectory of the jdk folder. You also have to tell the IDE you use to look there for this file. In JCreator, first click on Configure, then on Options…, and then on Profiles. You should see the version of JDK that you are using listed there. Click on it and then on Edit. When you see the next window, click on Add and then Add Package… Browse until you find the lib subdirectory and then click on servlet.jar. This will tell the compiler where to find the HttpServlet classes needed to compile a servlet. Registering an Access Database To connect to the database using a Java servlet, you must first register the database with the operating system. In Windows 98 this is done by clicking on Settings/Control Panel/Data Sources (ODBC). In Windows 2000 or XP, you will find this same file in Settings/Control Panel/Administrative Tools. Select Add/Microsoft Access Driver (*.mdb), and from there Browse to find the location of your database. The connection is done with a jdbc-odbc bridge. Jdbc stands for Java database connectivity API (application programming interface), while the ‘O’ in Odbc stands for Open. Odbc is a protocol from Microsoft that is based on the X/Open SQL specification. Setting localhost In Windows 2000 or XP, you can set localhost as an Environment Variable. Go into Settings/Control Panel/System/Advanced/System Variables. Choose New and then enter localhost as the Variable name and 127.0.0.1 as the Variable value. In Windows 98, use Windows Explorer to find Autoexec.bat. It is in the C:\System folder. Edit it and add the line SET localhost=127.0.0.1. When you next boot up your computer, this file will be executed and will set the environment variable. Sources of Information1. Susan Anderson-Freed, Weaving a Website, Prentice Hall, 2002. 2. Randal Bryant and David O’Hallaron, Computer Systems, A Programmer’s Perspective, Prentice-Hall, 2003, pages 816-841. 3. H.M. Deitel, P.J. Deitel, and T.R. Nieto, Internet & World Wide Web, How to Program, 2nd Edition, Prentice Hall, 2002. 4. Marty Hall & Larry Brown, Core Servlets and Java Server Pages, First Edition, Sun Microsystems Press/Prentice-Hall PTR Book, 2003. 5. Elliotte Rusty Harold, Java Network Programming, O’Reilly & Associates, Inc., 2000. 6. Elliotte Rusty Harold and Scott Means, XML Programming, O’Reilly & Associates, Inc., 2004. 7. Karl Moss, Java Servlets Developer’s Guide, McGraw-Hill/Osborne, 2002. 8. William Stallings, Data & Computer Communications, 6th Edition, Prentice-Hall, Inc., 2000. 9. W3 Schools Online Web Tutorials, http://www.w3schools.com. 10. Cathy Zura, Class Notes for CS 396N, http://matrix.csis.pace.edu/~czura/cs396n/,


View Full Document
Download The Stand Alone Server
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view The Stand Alone Server and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view The Stand Alone Server 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?