us.souther.select
Class HolidaySelectorServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
us.souther.select.HolidaySelectorServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public class HolidaySelectorServlet
- extends javax.servlet.http.HttpServlet
This is the controller portion of an MVC app that demonstrates one way to
build work with dynamic select boxes.
Legal Notice:
This code was written for demonstration purposes only.
The author of this code assumes no responsibility for damage resulting in
it's use. You may do whatever you like with it but at your own risk.
It is your responsibility to understand how it works and determine if it is
dependable enough, stable enough, and secure enough for your intended purpose.
- Since:
- Sat Apr 23 15:56:51 EDT 2005
- Author:
- Ben Souther; ben@souther.us
- See Also:
- Serialized Form
Method Summary |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles all GET requests by simply forwarding the user to the
JSP. |
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles POST requests from the JSP. |
void |
init(javax.servlet.ServletConfig config)
Initializes the servlet by instanciating the imatation database
object and binding it to context scope. |
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, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HolidaySelectorServlet
public HolidaySelectorServlet()
init
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
- Initializes the servlet by instanciating the imatation database
object and binding it to context scope.
- Specified by:
init
in interface javax.servlet.Servlet
- Overrides:
init
in class javax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
doGet
public void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Handles all GET requests by simply forwarding the user to the
JSP.
- Overrides:
doGet
in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
java.io.IOException
doPost
public void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Handles POST requests from the JSP.
Expects the following form parameters.
- month: Must be a numeric string between from 0 to 12;
- holiday: {month}-{day}. Example, for Christmas "12-25".
If null or empty, it is assumed that the user has not
yet choosen a holiday and that the form was submitted
from an onclick event in the months select box.
- enter_button: If null, we assume that the user has not finshed
gathering the holiday information before submitting
the final form, else we assume that all the other
parameters are valid and the HolidayBean is given
the OK to show the holiday information via the
getInfo method.
- Overrides:
doPost
in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
java.io.IOException