Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.voytechs.example.helloworld
Class HelloWorldServlet  view HelloWorldServlet download HelloWorldServlet.java

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bycom.voytechs.html.application.ToolServlet
              extended bycom.voytechs.example.helloworld.HelloWorldServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class HelloWorldServlet
extends com.voytechs.html.application.ToolServlet

This is a sample application which simply displays HelloWorld message back to the client browser.
Here is how we write this application.

  1. subclass the ToolServlet class and define its abstract method createSessionPanel.
  2. In the method createSessionPanel() we create a new panel, add a Text("Hello World!!!") object and return it.
To install this application in your servlet environment, for tomcat we do the following. We have to define the new servlet in web.xml file and copy the files to the appropriate tomcat directory. We add to WEB-INF/web.xml file: HelloWorld com.voytechs.example.helloworld.HelloWorldServlet 5


Field Summary
 
Fields inherited from class com.voytechs.html.application.ToolServlet
 
Fields inherited from class javax.servlet.http.HttpServlet
 
Fields inherited from class javax.servlet.GenericServlet
 
Constructor Summary
HelloWorldServlet()
          Constructor for our HelloWorld application.
 
Method Summary
 com.voytechs.html.component.Panel createSessionPanel()
          This method is called for every new user session the servlet creates.
 
Methods inherited from class com.voytechs.html.application.ToolServlet
doGet, doPost, getName, getPath, getServletConfig, getToolServlets, init, main
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HelloWorldServlet

public HelloWorldServlet()
Constructor for our HelloWorld application. We simply need to do this step to define a uniq name for our application. This isn't really needed by our simple applicaton, but some advanced functionality utilizes these application names to allow servlets to interface with each other , ie. ToolServlet.getToolServlets(). So to be a sport, we need to provide the application name.

Method Detail

createSessionPanel

public com.voytechs.html.component.Panel createSessionPanel()
                                                     throws com.voytechs.html.event.EventException
This method is called for every new user session the servlet creates. That is, there is only 1 HelloWorldServlet object instance, but there can be many Panel object instances.