ch7.accountCookie
Class ControllerHelper

java.lang.Object
  extended by shared.HelperBaseCh4
      extended by shared.HelperBaseCh5
          extended by shared.HelperBaseCh6
              extended by ch7.accountLogin.ControllerHelper
                  extended by ch7.accountCookie.ControllerHelper

public class ControllerHelper
extends ControllerHelper

When the login page is requested, the cookies are checked for an account number. If there is an account number present, then the login page is bypassed and the the edit page is displayed. If the account number is in the database, then the data is retrieved and used to initialise the form elements.

The class extends the Account Login application. A new button is added so that a new user can log in. When this button is clicked, the cookie will be ignored.


Nested Class Summary
 
Nested classes/interfaces inherited from class shared.HelperBaseCh4
HelperBaseCh4.SessionData
 
Field Summary
 
Fields inherited from class ch7.accountLogin.ControllerHelper
data
 
Fields inherited from class shared.HelperBaseCh6
checked, selected
 
Fields inherited from class shared.HelperBaseCh4
logger, request, response
 
Constructor Summary
ControllerHelper(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          The only constructor for this class has parameters for the request and response objects.
 
Method Summary
 java.lang.String getMethod()
          The method that preforms the default actions when no button is clicked.
 java.lang.String jspLocation(java.lang.String page)
          Generates the full path to a JSP.
 java.lang.String newUserMethod()
          The method that preforms the actions associated with the new user button.
 java.lang.String processMethod()
          The method that preforms the actions associated with the process button.
 
Methods inherited from class ch7.accountLogin.ControllerHelper
confirmMethod, copyFromSession, doGet, doPost, editMethod, getData, initHibernate, loginMethod
 
Methods inherited from class shared.HelperBaseCh6
addChecked, addChoice, addSelected, clearMaps, clearProperty, getChecked, getSelected, invokeGetter, setCheckedAndSelected, setCheckedAndSelected
 
Methods inherited from class shared.HelperBaseCh5
getErrors, isValid, isValidProperty, setErrors
 
Methods inherited from class shared.HelperBaseCh4
addHelperToSession, addHelperToSession, executeButtonMethod, executeButtonMethod, fillBeanFromRequest, invokeButtonMethod, populateThrow, writeError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControllerHelper

public ControllerHelper(javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response)
The only constructor for this class has parameters for the request and response objects. These objects will be stored in member variables.

Parameters:
request - The object that encapsulates the request information that is needed to communicate with the browser.
response - The object that encapsulates the response information that is needed to communicate with the browser.
Method Detail

jspLocation

public java.lang.String jspLocation(java.lang.String page)
Generates the full path to a JSP.

Overrides:
jspLocation in class ControllerHelper
Parameters:
page - The name of the JSP. This will be appended to the path of the directory that contains the JSPs. Using this method forces all the JSPs to be in the same directory.
Returns:
The string that represents the complete path to the JSP. This path must be relative to the directory where the servlet is mapped or must begin with a /, which represents the root of the web application.

getMethod

public java.lang.String getMethod()
The method that preforms the default actions when no button is clicked. If there is a cookie, then the login page will be bypassed.

Overrides:
getMethod in class ControllerHelper
Returns:
The address of the JSP that will complete the request.

newUserMethod

public java.lang.String newUserMethod()
The method that preforms the actions associated with the new user button. When this button is clicked, the cookie is ignored, allowing a new user to log in.

Overrides:
newUserMethod in class ControllerHelper
Returns:
The address of the JSP that will complete the request.

processMethod

public java.lang.String processMethod()
The method that preforms the actions associated with the process button. Saves the bean to the database. Additionaly, it retrieves all the data from the database and places it in the request, so that the results can be retrived in a JSP.

Overrides:
processMethod in class ControllerHelper
Returns:
The address of the JSP that will complete the request.