• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF that that escapes apostrophes?

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've discovered that the "escape" attribute of the hutputText doesn't escape apostraphes. Does anyone know a slick way to do this? I'm inserting some text on a JSF page using

var treeModel = {identifier: 'id',label: 'label',
items: <hutputText value='#{AddApplicationPage.applications}' escape='false'/>

where the "getApplication" method returns the "toString()" method of a JSONArray object:

JSONArray applications;
/* applications var is populated */
rtn = applications.toString().replaceAll("\"", "");
return rtn;

Problem is, if that object contains apostrophes, the Javascript above parses incorrectly. For example, here is an output block:

var treeModel = {identifier: 'id',label: 'label',
items: [{id: 'app8',label: 'DAVE_TEST',description: 'dave's test',loginURL: 'http://url1.com/login.html',logoutURL: 'http://url2.com/login.html?logout=true'}]
};

Any suggestions on a clean way to escape the apostraphes above?

Thanks, - Dave
};
 
Darryl Nortje
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there Dave,

Have you tried making the escape attribute of outputText value = true?

What happens then?
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, yes, I gave that a shot to no avail. According to the documentation online it only escapes ampersands and commas. Yeah, not sure what that's about either. - Dave
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!