You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "superjoerch@gmx.de" <su...@gmx.de> on 2008/07/14 11:44:50 UTC

escape attribute inside the selectItem component is not evaluated

Hi ,
i tried to run this code:

<t:buffer into="#{myBuffer}">
     <h:outputText value="#{something}"/>
     <h:outputText value="#{somethingWithUnderline}"
                       style="text-decoration:underline"/>
     <h:outputText value="#{somethingelse}"/>
</t:buffer>

<h:selectOneRadio ... >
     <f:selectItem itemValue="1" itemLabel="#{myBuffer}" escape="false">
</h:selectOneRadio>

but my buffercontent is escaped by the selectOnRadio renderer. I take a 
look inside the selectItem component and i see there is a member named 
escape.
But the HtmlRadioRendererBase.renderGroupOrItemRadio() method does not 
fetch the escape value of the selectItem and the
HtmlRenderUtils.renderLabel method has not a parameter for the escape 
attribute.

Same problem is by using the <t:selectOneRadio ... > component.

To fix the problem i've done this:

HtmlRadioRendererBase.renderGroupOrItemRadio() Line ~199 :

// label element after the input
boolean componentDisabled = isDisabled(facesContext, selectOne);
boolean disabled = (componentDisabled || itemDisabled);
boolean escape = selectItem.isEscape();

HtmlRendererUtils.renderLabel(writer, selectOne, itemId,
				selectItem.getLabel(), disabled,escape);

HtmlRendererUtils.renderLabel() Line ~1352:

public static void renderLabel(ResponseWriter writer, UIComponent 	
	component, String forClientId,String labelValue, boolean 	
				disabled) throws IOException {
renderLabel(writer, component, forClientId, labelValue, disabled, true);
}


/**
  * Renders a label HTML element
  */
public static void renderLabel(ResponseWriter writer, UIComponent
			component, String forClientId,String labelValue, 		boolean disabled, 
boolean escape) throws IOException {

...

if ((labelValue != null) && (labelValue.length() > 0)) {
	writer.write(HTML.NBSP_ENTITY);
	if (escape) {
		writer.writeText(labelValue, null);
	} else {
		writer.write(labelValue);
	}
}
...

maybe it helps someone.

bb, Jörg






Re: escape attribute inside the selectItem component is not evaluated

Posted by "superjoerch@gmx.de" <su...@gmx.de>.
Hi Simon,

i've created a jira issue --> MYFACES-1897, but i don't found the 
"licensed under the ASF" checkbox to tick them. Maybe you can do it for 
me, if you want or can or ... ;)

bb, Jörg

simon.kitching@chello.at schrieb:
> superjoerch@gmx.de schrieb:
>> Hi ,
>> i tried to run this code:
>>
>> <t:buffer into="#{myBuffer}">
>>     <h:outputText value="#{something}"/>
>>     <h:outputText value="#{somethingWithUnderline}"
>>                       style="text-decoration:underline"/>
>>     <h:outputText value="#{somethingelse}"/>
>> </t:buffer>
>>
>> <h:selectOneRadio ... >
>>     <f:selectItem itemValue="1" itemLabel="#{myBuffer}" escape="false">
>> </h:selectOneRadio>
>>
>> but my buffercontent is escaped by the selectOnRadio renderer. I take 
>> a look inside the selectItem component and i see there is a member 
>> named escape.
> Weird.
> 
> There is no escape property documented for SelectItem here:
>  http://java.sun.com/javaee/javaserverfaces/1.1/docs/api/index.html
> 
> And there is no escape property documented for SelectItem here:
>  http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html
> 
> But there is one here:
>  http://java.sun.com/javaee/5/docs/api/
> 
> There is none implemented for myfaces core 1.1.x, but it is implemented 
> in core 1.2.x
> 
> Dennis Byrne added this attribute in r415043 with the message "added ... 
> for binary compatibility with the RI". So it would appear to be a case 
> where Sun's implementation was not compliant with the specification (how 
> the hell did it ever pass the TCK with an extra method in the API?!), 
> and myfaces was then tweaked to add the extra method. Given that 
> history, it's no big surprise if the renderers were not updated to match.
> 
> And (no surprise) it appears that the jee5 docs are being generated from 
> Sun's codebase, and therefore are picking up Sun's incompatibilities and 
> declaring them as "the spec". Sigh.
> 
>> But the HtmlRadioRendererBase.renderGroupOrItemRadio() method does not 
>> fetch the escape value of the selectItem and the
>> HtmlRenderUtils.renderLabel method has not a parameter for the escape 
>> attribute.
>>
>> Same problem is by using the <t:selectOneRadio ... > component.
>>
>> To fix the problem i've done this:
>>
>> HtmlRadioRendererBase.renderGroupOrItemRadio() Line ~199 :
>>
>> // label element after the input
>> boolean componentDisabled = isDisabled(facesContext, selectOne);
>> boolean disabled = (componentDisabled || itemDisabled);
>> boolean escape = selectItem.isEscape();
>>
>> HtmlRendererUtils.renderLabel(writer, selectOne, itemId,
>>                 selectItem.getLabel(), disabled,escape);
>>
>> HtmlRendererUtils.renderLabel() Line ~1352:
>>
>> public static void renderLabel(ResponseWriter writer, UIComponent    
>>     component, String forClientId,String labelValue, boolean    
>>                 disabled) throws IOException {
>> renderLabel(writer, component, forClientId, labelValue, disabled, true);
>> }
>>
>>
>> /**
>>  * Renders a label HTML element
>>  */
>> public static void renderLabel(ResponseWriter writer, UIComponent
>>             component, String forClientId,String labelValue,         
>> boolean disabled, boolean escape) throws IOException {
>>
>> ...
>>
>> if ((labelValue != null) && (labelValue.length() > 0)) {
>>     writer.write(HTML.NBSP_ENTITY);
>>     if (escape) {
>>         writer.writeText(labelValue, null);
>>     } else {
>>         writer.write(labelValue);
>>     }
>> }
>> ...
>>
>> maybe it helps someone.
> 
> I guess that for compatibility with the RI we should implement this too.
> 
> Could you please create a JIRA issue for this? If you are happy for your 
> patch to be included in myfaces, please remember to tick the "licensed 
> under the ASF" checkbox..
> 
> Thanks,
> Simon
> 
> 



Re: escape attribute inside the selectItem component is not evaluated

Posted by Ryan Lubke <Ry...@Sun.COM>.
I do want to clarify that the spec has been deficient in keeping the 
spec inline with the javadocs changes.  The escape properties for
UISelectItem and SelectItem were discussed and agreed upon by the
EG, hence their presence in the API, but it seems the same updates
weren't applied to Chapter 4.

I've been advocating not duplicating javadoc content within the spec
to avoid mistakes such as these.  Hopefully JSF 2.0 will rectify that.

At any rate, I'll be logging spec bugs to have these issues resolved 
(hopefully in an MR).



Ryan Lubke wrote:
> 
> 
>> And there is no escape property documented for SelectItem here:
>>   http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html
> 
> I'll see what can be done about correcting the javadocs there.
> 
> 
>> Dennis Byrne added this attribute in r415043 with the message "added ... 
>> for binary compatibility with the RI". So it would appear to be a case 
>> where Sun's implementation was not compliant with the specification (how 
>> the hell did it ever pass the TCK with an extra method in the API?!), 
>> and myfaces was then tweaked to add the extra method. Given that 
>> history, it's no big surprise if the renderers were not updated to match.
>>
>> And (no surprise) it appears that the jee5 docs are being generated from 
>> Sun's codebase, and therefore are picking up Sun's incompatibilities and 
>> declaring them as "the spec". Sigh.
> 
> The spec mentions the escape attribute on pages 10 (preface) and
> page 9-33.  So I don't believe, outside of the mismatch mentioned above,
> that we've done anything incorrect.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/escape-attribute-inside-the-selectItem-component-is-not-evaluated-tp18440552p18454933.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: escape attribute inside the selectItem component is not evaluated

Posted by Ryan Lubke <Ry...@Sun.COM>.

> And there is no escape property documented for SelectItem here:
>   http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html

I'll see what can be done about correcting the javadocs there.


> Dennis Byrne added this attribute in r415043 with the message "added ... 
> for binary compatibility with the RI". So it would appear to be a case 
> where Sun's implementation was not compliant with the specification (how 
> the hell did it ever pass the TCK with an extra method in the API?!), 
> and myfaces was then tweaked to add the extra method. Given that 
> history, it's no big surprise if the renderers were not updated to match.
>
> And (no surprise) it appears that the jee5 docs are being generated from 
> Sun's codebase, and therefore are picking up Sun's incompatibilities and 
> declaring them as "the spec". Sigh.

The spec mentions the escape attribute on pages 10 (preface) and
page 9-33.  So I don't believe, outside of the mismatch mentioned above,
that we've done anything incorrect.


-- 
View this message in context: http://www.nabble.com/escape-attribute-inside-the-selectItem-component-is-not-evaluated-tp18440552p18454330.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: escape attribute inside the selectItem component is not evaluated

Posted by "simon.kitching@chello.at" <si...@chello.at>.
superjoerch@gmx.de schrieb:
> Hi ,
> i tried to run this code:
>
> <t:buffer into="#{myBuffer}">
>     <h:outputText value="#{something}"/>
>     <h:outputText value="#{somethingWithUnderline}"
>                       style="text-decoration:underline"/>
>     <h:outputText value="#{somethingelse}"/>
> </t:buffer>
>
> <h:selectOneRadio ... >
>     <f:selectItem itemValue="1" itemLabel="#{myBuffer}" escape="false">
> </h:selectOneRadio>
>
> but my buffercontent is escaped by the selectOnRadio renderer. I take 
> a look inside the selectItem component and i see there is a member 
> named escape.
Weird.

There is no escape property documented for SelectItem here:
  http://java.sun.com/javaee/javaserverfaces/1.1/docs/api/index.html

And there is no escape property documented for SelectItem here:
  http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html

But there is one here:
  http://java.sun.com/javaee/5/docs/api/

There is none implemented for myfaces core 1.1.x, but it is implemented 
in core 1.2.x

Dennis Byrne added this attribute in r415043 with the message "added ... 
for binary compatibility with the RI". So it would appear to be a case 
where Sun's implementation was not compliant with the specification (how 
the hell did it ever pass the TCK with an extra method in the API?!), 
and myfaces was then tweaked to add the extra method. Given that 
history, it's no big surprise if the renderers were not updated to match.

And (no surprise) it appears that the jee5 docs are being generated from 
Sun's codebase, and therefore are picking up Sun's incompatibilities and 
declaring them as "the spec". Sigh.

> But the HtmlRadioRendererBase.renderGroupOrItemRadio() method does not 
> fetch the escape value of the selectItem and the
> HtmlRenderUtils.renderLabel method has not a parameter for the escape 
> attribute.
>
> Same problem is by using the <t:selectOneRadio ... > component.
>
> To fix the problem i've done this:
>
> HtmlRadioRendererBase.renderGroupOrItemRadio() Line ~199 :
>
> // label element after the input
> boolean componentDisabled = isDisabled(facesContext, selectOne);
> boolean disabled = (componentDisabled || itemDisabled);
> boolean escape = selectItem.isEscape();
>
> HtmlRendererUtils.renderLabel(writer, selectOne, itemId,
>                 selectItem.getLabel(), disabled,escape);
>
> HtmlRendererUtils.renderLabel() Line ~1352:
>
> public static void renderLabel(ResponseWriter writer, UIComponent    
>     component, String forClientId,String labelValue, boolean    
>                 disabled) throws IOException {
> renderLabel(writer, component, forClientId, labelValue, disabled, true);
> }
>
>
> /**
>  * Renders a label HTML element
>  */
> public static void renderLabel(ResponseWriter writer, UIComponent
>             component, String forClientId,String labelValue,         
> boolean disabled, boolean escape) throws IOException {
>
> ...
>
> if ((labelValue != null) && (labelValue.length() > 0)) {
>     writer.write(HTML.NBSP_ENTITY);
>     if (escape) {
>         writer.writeText(labelValue, null);
>     } else {
>         writer.write(labelValue);
>     }
> }
> ...
>
> maybe it helps someone.

I guess that for compatibility with the RI we should implement this too.

Could you please create a JIRA issue for this? If you are happy for your 
patch to be included in myfaces, please remember to tick the "licensed 
under the ASF" checkbox..

Thanks,
Simon