net.sourceforge.stripes.action
Class ValidationErrorReportResolution

java.lang.Object
  extended by net.sourceforge.stripes.action.ValidationErrorReportResolution
All Implemented Interfaces:
Resolution

public class ValidationErrorReportResolution
extends Object
implements Resolution

A resolution that streams a simple HTML response to the client detailing the validation errors that apply for an ActionBeanContext.

Since:
Stripes 1.5.5
Author:
Ben Gunter

Constructor Summary
ValidationErrorReportResolution(ActionBeanContext context)
          Construct a new instance to report validation errors in the specified context.
 
Method Summary
 void execute(HttpServletRequest request, HttpServletResponse response)
          Called by the Stripes dispatcher to invoke the Resolution.
 ActionBeanContext getContext()
          Get the action bean context on which the validation errors occurred.
protected  String getResource(ResourceBundle bundle, String name, String fallback)
          Utility method that is used to lookup the resources used for the error header, footer, and the strings that go before and after each error.
protected  void sendErrors(HttpServletRequest request, HttpServletResponse response)
          Called by execute(HttpServletRequest, HttpServletResponse) to write the actual validation errors to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationErrorReportResolution

public ValidationErrorReportResolution(ActionBeanContext context)
Construct a new instance to report validation errors in the specified context.

Method Detail

getContext

public ActionBeanContext getContext()
Get the action bean context on which the validation errors occurred.


execute

public void execute(HttpServletRequest request,
                    HttpServletResponse response)
             throws Exception
Description copied from interface: Resolution
Called by the Stripes dispatcher to invoke the Resolution. Should use the request and response provided to direct the user to an appropriate view.

Specified by:
execute in interface Resolution
Parameters:
request - the current HttpServletRequest
response - the current HttpServletResponse
Throws:
Exception - exceptions of any type may be thrown if the Resolution cannot be executed as intended

sendErrors

protected void sendErrors(HttpServletRequest request,
                          HttpServletResponse response)
                   throws Exception
Called by execute(HttpServletRequest, HttpServletResponse) to write the actual validation errors to the client. The header, footer, beforeError and afterError resources are used by this method.

Parameters:
request - The servlet request.
response - The servlet response.
Throws:
Exception

getResource

protected String getResource(ResourceBundle bundle,
                             String name,
                             String fallback)
Utility method that is used to lookup the resources used for the error header, footer, and the strings that go before and after each error.

Parameters:
bundle - the bundle to look up the resource from
name - the name of the resource to lookup (prefixes will be added)
fallback - a value to return if no resource can be found
Returns:
the value to use for the named resource


© Copyright 2005-2006, Stripes Development Team.