RE: Clay not escaping strings?
>From: "Richard Eggert" <[EMAIL PROTECTED]> > > > It sure would be nice if there were a way to tell Clay whether to escape such > strings (perhaps an "escapeProps" attribute added to the clay:clay > component). > In my case, the current behavior is never what I want to happen, and I > suspect > that would be the case in just about any application that doesn't need to > store > HTML in its managed beans. > > Sounds like a good idea. Please create a JIRA ticket. > > Rich Eggert > Member of Technical Staff > Proteus Technologies, LLC > http://www.proteus-technologies.com > Gary
RE: Clay not escaping strings?
See below. -Original Message- From: Gary VanMatre [mailto:[EMAIL PROTECTED] Sent: Thu 8/9/2007 11:53 AM To: user@shale.apache.org Subject: Re: Clay not escaping strings? > #{mybean.prop}). Actually, this doesn't work. I still get the same error message, which I can only assume is because Clay is internally nesting an f:verbatim (with escape="false") within the h:outputText. As I indicated in my other email, the only way to get this to work is to do this : Mockup value here (escape="true" is unnecessary here since that is the default behavior of outputText) It sure would be nice if there were a way to tell Clay whether to escape such strings (perhaps an "escapeProps" attribute added to the clay:clay component). In my case, the current behavior is never what I want to happen, and I suspect that would be the case in just about any application that doesn't need to store HTML in its managed beans. Rich Eggert Member of Technical Staff Proteus Technologies, LLC http://www.proteus-technologies.com
Re: Clay not escaping strings?
>From: "Richard Eggert" <[EMAIL PROTECTED]> > > I'm using Clay with HTML templates in an application on which I am working. > In > several cases, I refer to managed bean properties directly in my template > text > (e.g., #{mybean.prop}). I recently noticed MyFaces' ReducedHTMLParser > throwing exceptions about malformed HTML. Not finding any problems in my HTML > template itself, I looked at the generated page source and discovered that in > cases where a managed bean property contained special characters (in my case, > less-than and greater-than signs), Clay is apparently not escaping them > before > rendering them. > > Is this a bug in Clay or a "feature" (or a configuration problem on my part)? > This is a "feature" :-). The way that Clay works is that any markup in the template that doesn't map to a JSF component is treated as "verbatim". If the markup contains a value binding expression, it's evaluated but there is not an attempt to identify (parse out) a inline expression within the markup. In the example above, the value expression would equate to the following: ValueBinding vb = FacesContext.getCurrentInstance().createValueBinding("#{mybean.prop}"); Something you might try is wrapping these expressions is a span tag mapped to an outputText component. Consider: #{mybean.prop}). > Is there any workaround aside from putting calls to > org.apache.commons.lang.StringEscapeUtils.escapeHtml() in every managed bean > "getter" method that returns a String or wrapping all references in > > escape="true">? > > I'm using Shale v1.0.4. > > > Rich Eggert > Member of Technical Staff > Proteus Technologies, LLC > http://www.proteus-technologies.com Gary > >
RE: Clay not escaping strings?
Just a follow-up: Wrapping it in doesn't seem to work. Instead, I have to use #{mybean.prop} (I keep the body for mockup purposes). Rich Eggert Member of Technical Staff Proteus Technologies, LLC http://www.proteus-technologies.com -Original Message- From: Richard Eggert [mailto:[EMAIL PROTECTED] Sent: Thu 8/9/2007 10:31 AM To: user@shale.apache.org Subject: Clay not escaping strings? I'm using Clay with HTML templates in an application on which I am working. In several cases, I refer to managed bean properties directly in my template text (e.g., #{mybean.prop}). I recently noticed MyFaces' ReducedHTMLParser throwing exceptions about malformed HTML. Not finding any problems in my HTML template itself, I looked at the generated page source and discovered that in cases where a managed bean property contained special characters (in my case, less-than and greater-than signs), Clay is apparently not escaping them before rendering them. Is this a bug in Clay or a "feature" (or a configuration problem on my part)? Is there any workaround aside from putting calls to org.apache.commons.lang.StringEscapeUtils.escapeHtml() in every managed bean "getter" method that returns a String or wrapping all references in ? I'm using Shale v1.0.4. Rich Eggert Member of Technical Staff Proteus Technologies, LLC http://www.proteus-technologies.com