dgraham 2003/08/16 10:50:10
Modified: src/share/org/apache/struts/action ExceptionHandler.java
Log:
Added storeException() method that takes an ActionMessage instead of
ActionError.
Revision Changes Path
1.21 +38 -10
jakarta-struts/src/share/org/apache/struts/action/ExceptionHandler.java
Index: ExceptionHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/ExceptionHandler.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- ExceptionHandler.java 7 Aug 2003 00:39:05 -0000 1.20
+++ ExceptionHandler.java 16 Aug 2003 17:50:10 -0000 1.21
@@ -168,17 +168,45 @@
* @param error - The error generated from the exception mapping
* @param forward - The forward generated from the input path (from the form or
exception mapping)
* @param scope - The scope of the exception mapping.
+ * @deprecated Use storeException(HttpServletRequest, String, ActionMessage,
ActionForward, String)
+ * instead. This will be removed after Struts 1.2.
*/
- protected void storeException(HttpServletRequest request,
- String property,
- ActionError error,
- ActionForward forward,
- String scope) {
-
+ protected void storeException(
+ HttpServletRequest request,
+ String property,
+ ActionError error,
+ ActionForward forward,
+ String scope) {
+
+ this.storeException(request, property, error, forward, scope);
+ }
+
+ /**
+ * Default implementation for handling an <b>ActionMessage</b> generated
+ * from an Exception during <b>Action</b> delegation. The default
+ * implementation is to set an attribute of the request or session, as
+ * defined by the scope provided (the scope from the exception mapping). An
+ * <b>ActionErrors</b> instance is created, the error is added to the
+ * collection and the collection is set under the Globals.ERROR_KEY.
+ *
+ * @param request - The request we are handling
+ * @param property - The property name to use for this error
+ * @param error - The error generated from the exception mapping
+ * @param forward - The forward generated from the input path (from the form or
exception mapping)
+ * @param scope - The scope of the exception mapping.
+ * @since Struts 1.2
+ */
+ protected void storeException(
+ HttpServletRequest request,
+ String property,
+ ActionMessage error,
+ ActionForward forward,
+ String scope) {
+
ActionErrors errors = new ActionErrors();
errors.add(property, error);
- if ("request".equals(scope)){
+ if ("request".equals(scope)) {
request.setAttribute(Globals.ERROR_KEY, errors);
} else {
request.getSession().setAttribute(Globals.ERROR_KEY, errors);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]