Kruse, Matt ([EMAIL PROTECTED]) wrote:

> > From: Gemes Tibor [mailto:[EMAIL PROTECTED]
> > addName('<bean:write name="person" property="lastname" 
> > filter="true"/>');
> > This filters the html sensitive chars. 
> 
> Nope, that doesn't do the job (filter is true by default, btw).
> 
> It creates output like this:
> 
> addName('O&#39;Reilly');
> 
> which causes javascript errors.
> Instead, it should be:
> 
> addName('O\'Reilly');
> 
> Since I already had my own taglib which wrapped bean:write, I just added
> another attribute called javascriptEscape to be set to either true or false.
> 
> It does:
>   ' to \'
>   " to &quot;
>   \n(newline) to \n (\\n)
>   \r(newline) to \r (\\r)

Which is exactly what the string taglib does from
jakarta.apache.org, plus a lot of other cool things (think wordwrap
and nl2br)

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <[EMAIL PROTECTED]>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Results! Why, man, I have gotten a ton of results! 
I know several thousand things that won't work! 
 --Thomas Edison
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to