Test webapp

adriani.webapp
Class ServletTwo

java.lang.Object
  extended by HttpServlet
      extended by adriani.webapp.ServletTwo

public class ServletTwo
extends HttpServlet

A simple servlet mapped to the logic name "servletTwo" by the web.xml configuration file. This class implements a simple HTML controller receiving data via the POST method. Scope and mapping rules are defined in the web.xml configuration file. For example:


     <servlet-name>servletTwo</servlet-name>
      <url-pattern>/controller</url-pattern>
 
Specify that this servlet will be invoked when calling the URL "/controller". In the Test web app enviroment this should happen when calling the URL:

http://localhost:8080/test/controller


Constructor Summary
ServletTwo()
           
 
Method Summary
 void doGet(HttpServletRequest request, HttpServletResponse response)
          Method invoked when the servlet is activated by a normal URL request (i.e. a GET request).
 void doPost(HttpServletRequest request, HttpServletResponse response)
          Method invoked when the servlet is activated receiving an HTML form (i.e. a POST request).
 int[] getSelection(java.lang.String reference, java.lang.String theValue)
          Retrieve an array of "boolean-like" parameters from an HTTP POST request.
 void init(ServletConfig config)
          Method automatically invoked by the Servlet Container the first time the servlet is called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletTwo

public ServletTwo()
Method Detail

init

public void init(ServletConfig config)
          throws ServletException
Method automatically invoked by the Servlet Container the first time the servlet is called.

Throws:
ServletException

doGet

public void doGet(HttpServletRequest request,
                  HttpServletResponse response)
           throws ServletException,
                  java.io.IOException
Method invoked when the servlet is activated by a normal URL request (i.e. a GET request). If it's necessary to read incoming HTTP parameters or cookies use the request object. To send data to the client browser use the response object.

Parameters:
request - the HTTP request (passed automatically by Tomcat).
response - the HTTP response (returned automatically by Tomcat).
Throws:
ServletException
java.io.IOException

doPost

public void doPost(HttpServletRequest request,
                   HttpServletResponse response)
            throws ServletException,
                   java.io.IOException
Method invoked when the servlet is activated receiving an HTML form (i.e. a POST request).

Parameters:
request - the HTTP request (passed automatically by Tomcat).
response - the HTTP response (returned automatically by Tomcat).
Throws:
ServletException
java.io.IOException

getSelection

public int[] getSelection(java.lang.String reference,
                          java.lang.String theValue)
Retrieve an array of "boolean-like" parameters from an HTTP POST request.

Parameters:
reference - the String value common to all the income parameters (e.g. "check_").
theValue - the String value bound to the "true" value (e.g "on", "yes" or something else).
Returns:
the array of the boolean values.

Build 21/09/2009

Morpheus Quality Technologies - making the Zion software
Copyright © 2009 Stefano Adriani. All Rights Reserved