在Struts2中使用jQuery模板 [英] Using jQuery Templates in Struts2

查看:56
本文介绍了在Struts2中使用jQuery模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Struts2更新页面(使用jOWL显示本体).原始的HTML页面使用jQuery模板,其中包含几行,例如:

I am attempting to update a page using Struts2 (using jOWL to display an ontology). The original HTML page uses jQuery templates, having several lines such as:

<h2 class="propertybox title" data-jowl="rdfs:label">${rdfs:label}</h2>
<span class="alt">${?p}</span><span>: </span><span>${?t}</span>

显示在jQuery脚本文件中确定的变量.作为.html文件,它可以很好地工作.但是,.jsp文件认为我正在尝试使用Struts变量而不是jQuery模板.遇到冒号和问号时会崩溃.

to display a variable determined in a jQuery script file. This works well enough as a .html file. However, the .jsp file thinks I am attempting to use Struts variables rather than a jQuery template. It crashes when it encounters the colon and question mark.

我确实找到了一些 jQuery Struts2库,但是我没有找到看不到任何可以映射到jQuery模板的标签.还有另一种方法吗?

I did find some jQuery Struts2 libraries, but I didn't see any tags that would map to jQuery templates. Is there another way to do this?

推荐答案

您的问题是jsp认为$ {}是EL.因此,您需要以某种方式逃避快递的一部分,这不会很漂亮:

Your issue is that a jsp thinks ${} is EL. So you need to somehow escape part of the express, this isn't going to be pretty:

From the JSP 2 spec:

For literal values that include the character sequence ${, JSP 2.0 provides a
way to escape them by using the sequence ${'${'. For example, the following
character sequence is translated into the literal value ${expr}:

${'${'}expr}

来源: http://www.velocityreviews. com/forums/t129212-ot-jsp-escape-el-expressions.html

这篇关于在Struts2中使用jQuery模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆