You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Musachy Barroso (JIRA)" <ji...@apache.org> on 2008/12/01 19:26:37 UTC

[jira] Resolved: (WW-2555) Add javaScriptEscape attribute to propertyTag

     [ https://issues.apache.org/struts/browse/WW-2555?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-2555.
---------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 2.2.x)
                   2.1.3

I changed the property name to "escapeJavaScript", and added a test to struts core. Thanks for the patch.

> Add javaScriptEscape attribute to propertyTag
> ---------------------------------------------
>
>                 Key: WW-2555
>                 URL: https://issues.apache.org/struts/browse/WW-2555
>             Project: Struts 2
>          Issue Type: New Feature
>          Components: Plugin - Tags
>    Affects Versions: 2.0.11.1, 2.1.0
>            Reporter: Jelmer Kuperus
>             Fix For: 2.1.3
>
>         Attachments: struts.patch, xwork.patch
>
>
> Currently if you want to use a property value in a piece of javascript you have to take care of escaping special characters such as \r \n \t , single quotes etc yourself. Otherwise you might end up with unclosed string literals etc. The way we solved this in out application is to wrap  the output of a struts property within the body of another tag that does the escaping. eg:
> alert('<lib:javaScriptEscape><s:property value="myProperty"/></lib:javaScriptEscape>');
> This works well but is somewhat verbose. It would be very convenient if  s:property would have a javaScriptEscape attribute to acomplish the same task. eg :
> alert('<s:property value="myProperty" javaScriptEscape="true" />');

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.