Classes Java Server Pages - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Classes Java Server Pages

Description:

Date, StringTokenizer, BufferedReader, Connection, Statement, ResultSet, ... After compilation, the resulting .class files should be placed in the ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 7
Provided by: julie387
Category:
Tags: classes | date | java | pages | server

less

Transcript and Presenter's Notes

Title: Classes Java Server Pages


1
Classes - Java Server Pages
  • We can use standard Java classes and interfaces
  • Date, StringTokenizer, BufferedReader,
    Connection, Statement, ResultSet,
  • We can also code user-defined classes and use them

2
Classes - Java Server Pages
  • Your classes can be located anywhere
  • They can be part of a package
  • In this case, the first statement in your file
    should be
  • package packageName

3
Classes - Java Server Pages
  • package packageName
  • After compilation, the resulting .class files
    should be placed in the subdirectory (called
    packageName) of the directory pointed to by
    classpath
  • For us, that is
  • mainwebsite_html/WEB-INF/classes
  • ? place .class files in
  • mainwebsite_html/WEB-INF/classes/packageName
    directory

4
Classes - Java Server Pages
  • To use the class Foo from package myPackage in a
    JSP, use
  • lt_at_ page import myPackage.Foo gt
  • To use all the classes from package myPackage in
    a JSP, use
  • lt_at_ page import myPackage. gt

5
Classes - Java Server Pages
  • If your class is NOT part of a package
  • After compilation, the resulting .class file
    should be placed in the directory pointed to by
    classpath
  • For us, that is
  • mainwebsite_html/WEB-INF/classes
  • ? place .class files in
  • mainwebsite_html/WEB-INF/classes directory

6
Classes - Java Server Pages
  • To use the class Foo2 in a JSP, use
  • lt_at_ page import Foo gt
Write a Comment
User Comments (0)
About PowerShow.com