aspose file tools*
The moose likes JSF and the fly likes How do I prevent this value from getting escaped? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How do I prevent this value from getting escaped?" Watch "How do I prevent this value from getting escaped?" New topic
Author

How do I prevent this value from getting escaped?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi,

I'm using MyFaces 1.1.6 withi Tomahawk 1.1.9 on JBoss 5.1. I have



Thing is, if the value is empty, what actually gets output is " ", but I don't want this ... I want " ". However, I do want the value of "contactInfo.organization" to be escaped. Not sure if "escaped" is the right word to use here but hopefully you know what I'm talking about.

Thanks, - Dave
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16140
    
  21

I think that you're doing this the hard way. And I'm not 100% sure that EL supports the trinary operator, but I'm too lazy to RTFM.

Just say:
code
<hutputText value="#{contactInfo.organization}"/>
[/code]

If the property value is null or an empty string, nothing will display. Otherwise the value will display. When you said display " ", it took you at your word. Since HTML is normally insensitive to spaces, it forced a space entity ( ) to ensure that what displayed was what you told it to. Notice I didn't say "what you wanted"!


Customer surveys are for companies who didn't pay proper attention to begin with.
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
The reason I asked for a " " is because the structure of the HTML is such that a blank space (" ") will cause the display to look off so I need something there in its place.

That said, I have experimented but it doesn't appear possible to do what I'm asking, unless you know an answer to the question posed.

Thanks, - Dave
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16140
    
  21

Dave Alvarado wrote:The reason I asked for a " " is because the structure of the HTML is such that a blank space (" ") will cause the display to look off so I need something there in its place.

That said, I have experimented but it doesn't appear possible to do what I'm asking, unless you know an answer to the question posed.

Thanks, - Dave


Now I'm confused. It appears you don't want a " ", you want a " ", but I don't know the difference between " " and " ".

An outputText element should still occupy a niche, even when displaying a null string, so that wouldn't upset grid and datatable views, so I'm totally
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I prevent this value from getting escaped?