nbubna 2003/03/01 14:59:56
Modified: struts/src/java/org/apache/velocity/tools/struts
ErrorsTool.java
Log:
add access to global error name and convenience method for retrieving global errors
Revision Changes Path
1.7 +34 -1
jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/struts/ErrorsTool.java
Index: ErrorsTool.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/struts/ErrorsTool.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ErrorsTool.java 13 Feb 2003 00:22:55 -0000 1.6
+++ ErrorsTool.java 1 Mar 2003 22:59:55 -0000 1.7
@@ -226,6 +226,28 @@
/**
+ * <p>
+ * This a convenience method and the equivalent of
+ * <code>$errors.get($errors.globalName)</code>
+ * </p>
+ * <p>
+ * Returns the set of localized error messages as an
+ * <code>java.util.ArrayList</code> of <code> java.lang.String</code>
+ * for all errors queued of the global category or <code>null</code>
+ * if no error are queued for the specified category.
+ * </p>
+ * <p>
+ * If the message resources don't contain an error message for a
+ * particular error key, the key itself is used as error message.
+ * </p>
+ */
+ public ArrayList getGlobal()
+ {
+ return get(getGlobalName());
+ }
+
+
+ /**
* Returns the set of localized error messages as an
* <code>java.util.ArrayList</code> of <code> java.lang.String</code>
* for all errors queued or <code>null</code> if no errors are queued.
@@ -332,5 +354,16 @@
{
return StrutsUtils.errorMarkup(property, request, session, application);
}
+
+
+ /**
+ * Returns the default "GLOBAL" category name that can be used for
+ * messages that are not associated with a particular property.
+ */
+ public String getGlobalName()
+ {
+ return StrutsUtils.getGlobalErrorName();
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]