L
laredotornado
Hi,
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
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