[
https://issues.apache.org/struts/browse/WW-2555?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jelmer Kuperus updated WW-2555:
-------------------------------
Component/s: Plugin - Tags
Description:
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" />');
was:
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"
javaScriptEscape="true" /></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" />');
Affects Version/s: 2.0.11.1
2.1.0
> 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
> 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.