Simple question,

When I want to use <bean:write> to print a value into a JSP, to be included
as an argument in a javascript function, how can I escape the output in
cases where it has ' and " and newline characters?

For example,
  addName('<bean:write name="person" property="lastname"/>');

If the "lastname" is O'Reilly, this causes a javascript error because the
output looks like:
  addName('O'Reilly');
When it SHOULD look like:
  addName('O\'Reilly');

I don't see anything in the docs to handle this - do I need to extend
bean:write with my own taglib?

Matt Kruse

Reply via email to