com.interface21.web.bind
Class ServletRequestDataBinder

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--com.interface21.validation.BindException
                    |
                    +--com.interface21.validation.DataBinder
                          |
                          +--com.interface21.web.bind.ServletRequestDataBinder
All Implemented Interfaces:
Errors, java.io.Serializable

public class ServletRequestDataBinder
extends DataBinder

Use this class to perform manual data binding from servlet request parameters to JavaBeans.

Author:
Rod Johnson
See Also:
Serialized Form

Fields inherited from class com.interface21.validation.DataBinder
logger, MISSING_FIELD_ERROR_CODE
 
Fields inherited from class com.interface21.validation.BindException
ERROR_KEY_PREFIX
 
Constructor Summary
ServletRequestDataBinder(java.lang.Object target, java.lang.String name)
           
 
Method Summary
 void bind(javax.servlet.ServletRequest request)
          Bind the parameters of the given request to this binder's target.
 void closeNoCatch()
          Treats errors as fatal.
 
Methods inherited from class com.interface21.validation.DataBinder
addPropertyChangeListener, addVetoableChangeListener, bind, close, getFieldValue, getRequiredFields, registerCustomEditor, registerCustomEditor, setRequiredFields
 
Methods inherited from class com.interface21.validation.BindException
addFieldError, getAllErrors, getBeanWrapper, getErrorCount, getFieldError, getFieldErrorCount, getFieldErrors, getGlobalError, getGlobalErrorCount, getGlobalErrors, getMessage, getModel, getObjectName, getTarget, hasErrors, hasFieldErrors, hasGlobalErrors, reject, rejectValue, setNestedPath
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, printStackTrace, printStackTrace, printStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServletRequestDataBinder

public ServletRequestDataBinder(java.lang.Object target,
                                java.lang.String name)
Method Detail

bind

public void bind(javax.servlet.ServletRequest request)
Bind the parameters of the given request to this binder's target. This call can create field errors, representing basic binding errors like a required field (code "required"), or type mismatch between value and bean property (code "typeMismatch").
Parameters:
request - request with parameters to bind

closeNoCatch

public void closeNoCatch()
                  throws ServletRequestBindingException
Treats errors as fatal. Use this method only if it's an error if the input isn't valid. This might be appropriate if all input is from dropdowns, for example.
Throws:
ServletRequestBindingException - subclass of ServletException on any binding problem


Rod Johnson and Spring contributors 2001-2003.