« Return to Thread: h:commandButton escape xml problem

Re: h:commandButton escape xml problem

by Fırat KÜÇÜK :: Rate this Message:

Reply to Author | View in Thread

Hi,
this sould be a solution:
<h:commandButton value="#{fn:escapeXml(bean.property)}" />

and the other one: simple facelets tag:

<new:commandButton value="#{bean.property}" escape="true" />

-------------------------------

<?xml version = '1.0' encoding = 'UTF-8'?>

<ui:composition xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets">
  <h:commandButton value="#{escape ? fn:escapeXml(value) : value}" />
</ui:composition>

i guess  there should be a way to extend h:commandButton.


08 Eylül 2009 22:25 tarihinde Werner Punz <werner.punz@...> yazdı:
Fırat KÜÇÜK schrieb:

Hi,
how we can escape xml from h:commandButton?

we may use this on h:commandLink

<h:commandLink id="loginSubmit">
 <h:outputText value="${resource.loginTitle}" escape="false"/>
</h:commandLink>

and h:commandLink does not have an escape attribute.

thanks.

From your code I assume you meant not escaping, aka embedding
xml or html code natively instead of escaping the chars.

Sorry there is no way to do that on a commandButton, have in mind that commandbutton maps to a html button and the tag itself is limited by what a html button can do and you cannot embed xml or html in a sane way in the text part of those controls. So you cannot replicate what you do
with the escape="false" for your embedded output text on the commandButton.

JSF in this case is innocent, HTML itself in all its gory glory sets the limits there.





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...




--
FIRAT KÜÇÜK

 « Return to Thread: h:commandButton escape xml problem