dgraham 2003/06/20 20:12:48 Modified: src/share/org/apache/struts/taglib/html OptionTag.java Log: Fixed display text selection logic for PR# 20949. Revision Changes Path 1.19 +16 -18 jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java Index: OptionTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- OptionTag.java 17 May 2003 03:42:00 -0000 1.18 +++ OptionTag.java 21 Jun 2003 03:12:48 -0000 1.19 @@ -286,7 +286,7 @@ if (disabled) { results.append(" disabled=\"disabled\""); } - if (this.selectTag().isMatched(value)) { + if (this.selectTag().isMatched(this.value)) { results.append(" selected=\"selected\""); } if (style != null) { @@ -305,13 +305,8 @@ results.append("\""); } results.append(">"); - - String text = text(); - if (text == null) { - results.append(value); - } else { - results.append(text); - } + + results.append(text()); results.append("</option>"); return results.toString(); @@ -359,15 +354,18 @@ * @exception JspException if an error occurs */ protected String text() throws JspException { + String optionText = this.text; + + if ((optionText == null) && (this.key != null)) { + optionText = RequestUtils.message(pageContext, bundle, locale, key); + } - if (this.text != null) { - return (this.text); - } else if (this.key != null) { - return (RequestUtils.message(pageContext, bundle, locale, key)); - } else { - return ""; // no body text and no key to lookup so display nothing + // no body text and no key to lookup so display the value + if (optionText == null) { + optionText = this.value; } + return optionText; } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]