Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
A.2 First Servlets
521
Java Web Server 2.0 Standard Directories
  install_dir/servlets 
Location for frequently changing servlet classes. Auto reloading.
  install_dir/classes 
Location for infrequently changing servlet classes.
  install_dir/lib 
Location for JAR files containing classes.
A.2 First Servlets
Simple Servlet 
HelloWWW.java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWWW extends HttpServlet {
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String docType =
      "
      "Transitional//EN\">\n";
    out.println(docType +
                "\n" +
                "Hello WWW\n" +
                "\n" +
                "

Hello WWW

\n" +
                "");
  }
}
Installing Servlets
  Put in servlet directories shown in Section A.1.
  Put in subdirectories corresponding to their package.
Invoking Servlets
  http://host/servlet/ServletName
  http://host/servlet/package.ServletName
  Arbitrary location defined by server specific customization.
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

jsp web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved