File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes escape attribute in h:outputText component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "escape attribute in h:outputText component" Watch "escape attribute in h:outputText component" New topic
Author

escape attribute in h:outputText component

leo donahue
Ranch Hand

Joined: Apr 17, 2003
Posts: 327
I am about a week new to using JSF for the first time.

I am referencing the mojarra-2.0.0-PR2-binary JSF library in eclipse.

I have some source data that contains the characters "<, >, &"

I'm reading through an older version of "Core Java Server Faces" in which the author indicates that by default the escape attribute for a h:outputText tag is false. However, eclipse is telling me that the escape attribute is "true" by default. Maybe it was false by default in JSF 1.2? Either way, when I run my faces page, I get the following message telling me that:

"The value of attribute "value" must not contain the '<' character."

I'm using the following code:


Whether the escape attribute is set to true or false in my .jsp, I still get the message indicating that the value must not contain the '<' character. I don't understand why the text is not being escaped.

Am I missing something here?


Thanks, leo
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
leo donahue wrote:
I'm reading through an older version of &quot;Core Java Server Faces&quot; in which the author indicates that by default the escape attribute for a h:outputText tag is false. However, eclipse is telling me that the escape attribute is &quot;true&quot; by default. Maybe it was false by default in JSF 1.2?

Eclipse is just a tool. The real answer is in the TLDDOC.

Either way, when I run my faces page, I get the following message telling me that:

Who sent you that message? When is it been sent? Does the app just run correctly or not? Is the generated HTML source correct? Is the displayed HTML output correct?
leo donahue
Ranch Hand

Joined: Apr 17, 2003
Posts: 327
Who sent you that message? When is it been sent? Does the app just run correctly or not? Is the generated HTML source correct? Is the displayed HTML output correct?

That is the response I get from using Tomcat 6.0.18 and the message is output in the Console window of the eclipse IDE. If I don't use eclipse and just run the webapp from Tomcat, I just get the page described in my next paragraph.

I have a results.jsp page with two h:dataTable tags. The first dataTable tag contains the reference to the field that has the speicial characters. When I encounter a search yeilding results which have those special characters, the page just displays the place holders (h:column and h:facet) for each of the fields in each dataTable. No data is returned for either dataTable. If I search for a value in which I know there will be no special characters, both h:dataTables fill with the correct data on the results.jsp
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: escape attribute in h:outputText component