shared
Class HelperBaseCh5

java.lang.Object
  extended by shared.HelperBaseCh4
      extended by shared.HelperBaseCh5
Direct Known Subclasses:
ControllerHelper, ControllerHelper, ControllerHelper, ControllerHelper, HelperBaseCh6

public abstract class HelperBaseCh5
extends HelperBaseCh4

Helper base class for Chapter 5. It is also the super class for HelperBaseCh6.


Nested Class Summary
 
Nested classes/interfaces inherited from class shared.HelperBaseCh4
HelperBaseCh4.SessionData
 
Field Summary
 
Fields inherited from class shared.HelperBaseCh4
logger, request, response
 
Constructor Summary
HelperBaseCh5(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Call the super class to initialise the request and response.
 
Method Summary
 java.util.Map getErrors()
          Accessor for the map of errors; needed so that the JSPs can access the errors.
 boolean isValid(java.lang.Object data)
          Set the errors and return true if there are no errors.
 boolean isValidProperty(java.lang.String name)
          This method tests if the error messages contains an entry for a particular field.
 void setErrors(java.lang.Object data)
          Executes Hibernate to generate error messages and copies the messages into a map that can be accessed easily from the JSPs using Expression Language.
 
Methods inherited from class shared.HelperBaseCh4
addHelperToSession, addHelperToSession, copyFromSession, doGet, doPost, executeButtonMethod, executeButtonMethod, fillBeanFromRequest, invokeButtonMethod, writeError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HelperBaseCh5

public HelperBaseCh5(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
Call the super class to initialise the request and response.

Parameters:
request - Request information encapsulated in a Java object
response - Response information encapsulated in a Java object
Method Detail

setErrors

public void setErrors(java.lang.Object data)
Executes Hibernate to generate error messages and copies the messages into a map that can be accessed easily from the JSPs using Expression Language.

Parameters:
data - The bean to validate

isValid

public boolean isValid(java.lang.Object data)
Set the errors and return true if there are no errors.

Parameters:
data - The bean to validate.
Returns:
true if there are no errors; false if there are errors.

getErrors

public java.util.Map getErrors()
Accessor for the map of errors; needed so that the JSPs can access the errors.

Returns:
The error map

isValidProperty

public boolean isValidProperty(java.lang.String name)
This method tests if the error messages contains an entry for a particular field. This method does not call setErrors,call setErrors before calling this method.

Parameters:
name - The name of the property to validate
Returns:
true if the property is valid; false, otherwise