|
Test webapp | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectHttpServlet
adriani.webapp.ServletTwo
public class ServletTwo
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 |
---|
public ServletTwo()
Method Detail |
---|
public void init(ServletConfig config) throws ServletException
ServletException
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
request
object.
To send data to the client browser use the response
object.
request
- the HTTP request (passed automatically by Tomcat).response
- the HTTP response (returned automatically by Tomcat).
ServletException
java.io.IOException
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
request
- the HTTP request (passed automatically by Tomcat).response
- the HTTP response (returned automatically by Tomcat).
ServletException
java.io.IOException
public int[] getSelection(java.lang.String reference, java.lang.String theValue)
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).
|
Build 21/09/2009 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |