You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by kindsol <ki...@hotpop.com> on 2008/04/29 20:23:34 UTC

h:outputFormat does not allow html snippet in value-binded f:param

Please help.  I am stuck.

It seems that h:outputFormat will always escape my f:param value if  
it is value-binded, basically ignoring the 'escape' attribute.   
Static values for f:param are escaped correctly, and so display html  
snippets fine.  I am attempting to send an HTML snippet from my  
backing bean to be inserted into a compound message.

Any ideas why the second example (below) works as it does?  The  
f:param value for both examples uses the exact same string.  The only  
difference is one is static and the other is passed from my backing  
bean.

Any help is greatly appreciated.  I am using myfaces 1.1.5

-Sol



Static Binding Example: (works fine)

myBundle.properties
...
HeresYourLink=Here is a link to {0}.
...

myHtml.faces
...
<h:outputFormat value="#{msg. HeresYourLink}"  escape="false" >
	<f:param value="&lt;a href='http://www.google.com' target='_blank'  
style='text-decoration:underline;' &gt;Google&lt;/a&gt;" />
</h:outputFormat>
...

Resulting HTML (Displays as a link)
Here is a link to <a style="text-decoration: underline;"  
target="_blank" href="http://www.google.com">Google</a>.



Value-Binded Example: (doesn't work as I expect)

myHtml.faces
...
<h:outputFormat value="#{msg. HeresYourLink}" escape="false"  >	
	<f:param value="#{myBean.link}" />
</h:outputFormat>
...

myBean.java
...
public String getLink() {
	return "&lt;a href='http://www.google.com' target='_blank'  
style='text-decoration:underline;' &gt;Google&lt;/a&gt;";
}
...

Resulting HTML (displays as *text only*)
Here is a link to <a href='http://www.google.com' target='_blank'  
style='text-decoration:underline;' >Google</a>.