craigmcc 01/02/12 14:23:51
Modified: src/doc struts-html.xml
src/share/org/apache/struts/taglib/html ErrorsTag.java
Log:
Add a "bundle" attribute to the <html:errors> tag, consistent with the way
this works on <bean:message> and <html:image>, so that you can extract
error message text strings from more than one MessageResources bundle.
The default is still the global application resources bundle.
Submitted by: Alan C. Yackel <[EMAIL PROTECTED]>
PR: Bugzilla #577
Revision Changes Path
1.9 +11 -0 jakarta-struts/src/doc/struts-html.xml
Index: struts-html.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/src/doc/struts-html.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- struts-html.xml 2001/02/10 23:31:49 1.8
+++ struts-html.xml 2001/02/12 22:23:48 1.9
@@ -703,6 +703,17 @@
</ul>
</info>
+ <attribute>
+ <name>bundle</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <info>
+ The servlet context attribute key for the MessageResources
+ instance to use. If not specified, defaults to the
+ application resources configured for our action servlet.
+ </info>
+ </attribute>
+
<attribute>
<name>name</name>
<required>false</required>
1.4 +12 -5
jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java
Index: ErrorsTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ErrorsTag.java 2001/01/27 20:09:43 1.3
+++ ErrorsTag.java 2001/02/12 22:23:50 1.4
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v 1.3
2001/01/27 20:09:43 craigmcc Exp $
- * $Revision: 1.3 $
- * $Date: 2001/01/27 20:09:43 $
+ * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v 1.4
2001/02/12 22:23:50 craigmcc Exp $
+ * $Revision: 1.4 $
+ * $Date: 2001/02/12 22:23:50 $
*
* ====================================================================
*
@@ -96,7 +96,7 @@
* </ul>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.3 $ $Date: 2001/01/27 20:09:43 $
+ * @version $Revision: 1.4 $ $Date: 2001/02/12 22:23:50 $
*/
public class ErrorsTag extends TagSupport {
@@ -106,6 +106,12 @@
/**
+ * The servlet context attribute key for our resources.
+ */
+ protected String bundle = Action.MESSAGES_KEY;
+
+
+ /**
* The default locale on our server.
*/
protected static Locale defaultLocale = Locale.getDefault();
@@ -194,7 +200,7 @@
if (locale == null)
locale = defaultLocale;
MessageResources messages = (MessageResources)
- pageContext.getAttribute(Action.MESSAGES_KEY,
+ pageContext.getAttribute(bundle,
PageContext.APPLICATION_SCOPE);
String message = null;
StringBuffer results = new StringBuffer();
@@ -253,6 +259,7 @@
public void release() {
super.release();
+ bundle = Action.MESSAGES_KEY;
name = Action.ERROR_KEY;
property = null;