Home arrow Java & J2EE arrow Page 10 - Developing JavaServer Pages

Managing Java Classes - Java

In this excerpt from chapter 4 of Joel Murach's Java Servlets and JSP, you'll learn how to develop a web application that consists of HTML pages and JavaServer Pages (JSPs). As you will see, JSPs work fine as long as the amount of processing that's required for each page is limited. When you complete this chapter, you should be able to use JSPs to develop simple web applications of your own.

TABLE OF CONTENTS:
  1. Developing JavaServer Pages
  2. The Code for the HTML Page that Calls the JSP
  3. Imitating HTML
  4. How to Create a JSP
  5. How to Use the Methods of the Request Object
  6. Retrieving Multiple Values
  7. How to Request a JSP
  8. Using Get and Post Methods
  9. Using the Post Method
  10. Managing Java Classes
  11. Class Location
By: Joel Murach
Rating: starstarstarstarstar / 65
May 12, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

If you're using Tomcat 4.0, Figure 10 shows where and how to save your compiled Java classes (the .class files) so Tomcat can access them. Usually, you'll save your source code (the .java files) in the same directory, but that's not required.

Figure 10: Where and How to Save and Compile Regular Java Classes

Where the User class is saved

c:tomcatwebappsmurachWEB-INFclassesbusiness

Where the UserIO class is saved

c:tomcatwebappsmurachWEB-INFclassesdata

Other places to save your Java classes

c:tomcatwebappsyourDocumentRootWEB-INFclasses
c:tomcatwebappsyourDocumentRootWEB-INFclassespackageName
c:tomcatwebappsROOTWEB-INFclasses
c:tomcatwebappsROOTWEB-INFclassespackageName

The DOS Prompt Window for Compiling the User Class

Command Prompt

Description

Although you can save the source code (the .java files) in any directory, you must save the class files (the .class files) in the WEB-INFclasses directory or one of its subdirectories. This can be subordinate to the ROOT directory or your own document root directory.

To compile a class, you can use TextPad's Compile Java command, your IDE's compile command, or the javac command from the DOS prompt window.

If you have trouble compiling a class, make sure your system is configured correctly as described in appendix A of my textbook.

The two paths shown at the top of this figure show where the User and UserIO classes that come with this book are saved. After that, the figure presents the syntax for other paths that can be used to store Java classes. If you review these paths, you'll see that each one places the Java classes in a subdirectory of the WEB-INFclasses directory. 

Remember: this is from chapter four of Joel Murach's Java Servlets and JSP (Mike Murach & Associates, ISBN 1890774189, 2003). Grab a copy at your favorite book store today!

 Buy this book now.



 
 
>>> More Java & J2EE Articles          >>> More By Joel Murach
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

JAVA & J2EE ARTICLES

- More Java Bugs Lead to More Attacks
- Oracle's Java One Brings News, Surprises
- Oracle Patches Java Runtime Environment
- Apple Syncs Java Update with Oracle
- Spring 3.1 Java Development Framework Compat...
- Jelastic Java PaaS Availability and Pricing ...
- NetBeans 7.1 Released, Supports JavaFX 2
- SolarWinds Releases Newest Version of Java M...
- Free Monitoring Tool for Java Apps on Heroku
- Heroku Adds JCloud Platform Support, Java 7 ...
- Java SE 8 Speculation in Full Swing
- Java SE 7 Now Available
- New JVM Language and Java Reporting Tool
- Java 7 Release Update and New Eclipse Toolkit
- The Best Java Netbeans IDE Plugins

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: