Servlets at STS


Servlet Strategy at STS

Experts

JRun (LiveSoftware)

Java Web Server (Sun)

JavaServer Web Development Kit (Sun)

Version 1.0

Servletrunner (Sun)

Version 2.1 (early access)

Version 2.

Short Introduction: Servletrunner at STS (V. 2.0)

Jakarta-Tomcat


Einführung von Karsten Thurow

Einführung von Gerret Brandt

Allgemein

JDK

Apache/JServ

import java.io.*; 
import javax.servlet.*; 
import javax.servlet.http.*; 

public class firstServlet extends HttpServlet { 

public void init(ServletConfig conf) throws ServletException { 
 super.init(conf); 
 connections = 0; 
} 

public void service(HttpServletRequest req, HttpServletResponse res) 
 throws IOException{ 
   //Get a channel to the Web browser, so we can send output 
   ServletOutputStream out = res.getOutputStream(); 
  
   res.setContentType("text/html"); // Required for HTTP 

   out.println("<HTML><HEAD><TITLE>Servlets 101</TITLE></HEAD>"); 
   out.print("Say hello to Java Servlet Programming, "); 
   out.println(req.getParameter("userName")); 
   out.print("<p>You are caller number "); 
   connections++; 
   out.println(Integer.toString(connections)); 
   out.close(); //Close the output stream 
  } 

  int connections; 
}

Software Systems Institute 22-feb-2000 holm wegner