Play! framefork renders incorrectly arguments from a controller to a view
My controller action:
public static void showGalery() {
...
render(subPhotos, size);
}
A part of my view:
<img id="mainImage"
src="${subPhotos.get(0).path}"
class="galery-main-photo"
onmouseover="toolTip(${subPhotos.get(0).description});"
onmouseout="toolTip();" />
Path passed correcly from an action, but description incorrectly (javascript function doesn't call). If I write ${subPhotos.get(0).d开发者_如何转开发escription.length()}
then Javascript function are called and passed a correct length of a string.
From DB got a correct description.
Thanks, Sergey
Because the description is a string, you must surround it with quotes. Be sure to use single quotes, because the HTML attribute is using double quotes.
onmouseover="toolTip('${subPhotos.get(0).description}');"
精彩评论