10.5 Installation of JSP Pages

Servlets require you to set your CLASSPATH , use packages to avoid name conflicts, install the class files in servlet-specific locations, and use special-purpose URLs. Not so with JSP pages. JSP pages can be placed in the same directories as normal HTML pages, images, and style sheets; they can also be accessed through URLs of the same form as those for HTML pages, images, and style sheets. Here are a few examples of default installation locations (i.e., locations that apply when you aren't using custom Web applications) and associated URLs. Where we list SomeDirectory , you can use any directory name you like, except that you are never allowed to use WEB-INF or META-INF as directory names . When using the default Web application, you also have to avoid a directory name that matches the URL prefix of any other Web application. For information on defining your own Web applications, see Section 2.11.

JSP Directories for Tomcat (Default Web Application)

  • Main Location.

     
      install_dir  /webapps/ROOT 
  • Corresponding URL.

    http: //host/SomeFile. jsp

  • More Specific Location (Arbitrary Subdirectory).

     
      install_dir  /webapps/ROOT/  SomeDirectory  
  • Corresponding URL.

    http: //host/SomeDirectory/SomeFile. jsp

JSP Directories for JRun (Default Web Application)

  • Main Location.

     
      install_dir  /servers/default/default-ear/default-war 
  • Corresponding URL.

    http: //host/SomeFile. jsp

  • More Specific Location (Arbitrary Subdirectory).

     
      install_dir  /servers/default/default-ear/default-war/  SomeDirectory  
  • Corresponding URL.

    http: //host/SomeDirectory/SomeFile. jsp

JSP Directories for Resin (Default Web Application)

  • Main Location.

     
      install_dir  /doc 
  • Corresponding URL.

    http: //host/SomeFile. jsp

  • More Specific Location (Arbitrary Subdirectory).

     
      install_dir  /doc/  SomeDirectory  
  • Corresponding URL.

    http: //host/SomeDirectory/SomeFile. jsp

Note that, although JSP pages themselves need no special installation directories, any Java classes called from JSP pages still need to go in the standard locations used by servlet classes (e.g., .../WEB-INF/classes/ directoryMatchingPackageName ; see Section 2.10). Note that the Java classes used by JSP pages should always be in packages; this point is discussed further in later chapters.



Core Servlets and JavaServer Pages (Vol. 1.Core Technologies)
Core Servlets and Javaserver Pages: Core Technologies, Vol. 1 (2nd Edition)
ISBN: 0130092290
EAN: 2147483647
Year: 2002
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net