You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@apache.org on 2001/06/01 22:14:47 UTC
cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/html OptionsTag.java
craigmcc 01/06/01 13:14:47
Modified: src/share/org/apache/struts/taglib/html Tag:
STRUTS_1_0_BRANCH OptionsTag.java
Log:
Report the correct property name if the labelProperty attribute is
incorrect on an <html:options> tag.
PR: Bugzilla #1936
Submitted by: Zane Rockenbaugh <zr...@yahoo.com>
Revision Changes Path
No revision
No revision
1.7.2.2 +25 -3 jakarta-struts/src/share/org/apache/struts/taglib/html/OptionsTag.java
Index: OptionsTag.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionsTag.java,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -u -r1.7.2.1 -r1.7.2.2
--- OptionsTag.java 2001/05/20 21:20:10 1.7.2.1
+++ OptionsTag.java 2001/06/01 20:14:46 1.7.2.2
@@ -193,13 +193,31 @@
if (collection != null) {
Iterator collIterator = getIterator(collection, null);
while (collIterator.hasNext()) {
+
Object bean = collIterator.next();
Object value = null;
Object label = null;;
+
try {
value = PropertyUtils.getProperty(bean, property);
if (value == null)
value = "";
+ } catch (IllegalAccessException e) {
+ throw new JspException
+ (messages.getMessage("getter.access",
+ property, collection));
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getTargetException();
+ throw new JspException
+ (messages.getMessage("getter.result",
+ property, t.toString()));
+ } catch (NoSuchMethodException e) {
+ throw new JspException
+ (messages.getMessage("getter.method",
+ property, collection));
+ }
+
+ try {
if (labelProperty != null)
label =
PropertyUtils.getProperty(bean, labelProperty);
@@ -210,21 +228,25 @@
} catch (IllegalAccessException e) {
throw new JspException
(messages.getMessage("getter.access",
- property, collection));
+ labelProperty, collection));
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
throw new JspException
(messages.getMessage("getter.result",
- property, t.toString()));
+ labelProperty, t.toString()));
} catch (NoSuchMethodException e) {
throw new JspException
(messages.getMessage("getter.method",
- property, collection));
+ labelProperty, collection));
}
+
+
String stringValue = value.toString();
addOption(sb, stringValue, label.toString(),
selectTag.isMatched(stringValue));
+
}
+
}
// Otherwise, use the separate iterators mode to render options