Revision: 1091
http://stripes.svn.sourceforge.net/stripes/?rev=1091&view=rev
Author: bengunter
Date: 2009-03-03 15:17:55 +0000 (Tue, 03 Mar 2009)
Log Message:
-----------
Fixed STS-251 in a less restrictive way. If the label attribute is used to
generate the option's body then its value is HTML-encoded. But if the tag body
is used its value is not HTML-encoded. Instead, the value must be encoded some
other way, such as <c:out escapeXml="true" value="${value}" />. (But if you're
going to do that, then you might as well just use label="${value}".) I added a
paragraph to the TLD to document this behavior.
Modified Paths:
--------------
trunk/stripes/resources/stripes.tld
trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionTag.java
Modified: trunk/stripes/resources/stripes.tld
===================================================================
--- trunk/stripes/resources/stripes.tld 2009-03-03 03:58:40 UTC (rev 1090)
+++ trunk/stripes/resources/stripes.tld 2009-03-03 15:17:55 UTC (rev 1091)
@@ -970,6 +970,13 @@
<p>If the option has a body then the String value of that body
will be used to generate
the body of the generated HTML option. If the body is empty or
not present then the
label attribute will be written into the body of the tag.</p>
+
+ <p>If the label attribute's value is used, it will be HTML-encoded
before being written
+ out. However, the tag body, if present, will <em>not</em> be
HTML-encoded. This allows
+ the explicit use of HTML character entities within the tag, which
would be impossible
+ otherwise. If you choose to set the tag body and you want the
output to be HTML-encoded,
+ you must use something like the escapeXml attribute of the
<c:out> tag to
+ HTML-encode the value before passing it to
<stripes:option>.</p>
]]></description>
<display-name>option</display-name>
<name>option</name>
Modified: trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionTag.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionTag.java
2009-03-03 03:58:40 UTC (rev 1090)
+++ trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionTag.java
2009-03-03 15:17:55 UTC (rev 1091)
@@ -108,7 +108,7 @@
// Decide if the label will come from the body of the option, of the
label attr
String actualLabel = getBodyContentAsString();
if (actualLabel == null) {
- actualLabel = this.label;
+ actualLabel = HtmlUtil.encode(this.label);
}
// If no explicit value attribute set, use the tag label as the value
@@ -130,7 +130,7 @@
try {
writeOpenTag(getPageContext().getOut(), "option");
if (actualLabel != null) {
- getPageContext().getOut().write(HtmlUtil.encode(actualLabel));
+ getPageContext().getOut().write(actualLabel);
}
writeCloseTag(getPageContext().getOut(), "option");
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development