jsp里的${}和jquery template的${} 怎么样转义
来源:互联网 发布:个性地图制作软件 编辑:程序博客网 时间:2024/04/30 07:34
http://www.infoq.com/cn/news/2010/10/jQuery-Template
http://api.jquery.com/category/plugins/templates/
ms发布的jquery模板插件
在这个插件里他使用的变量占位符和jsp的el表达式用的是一样的${}, 所以在用jsp作为服务器端的输出时要进行转义, 不然jsp会把原本是属于jquery模板插件的变量也进行了替换. 以下介绍两种方式
1. escapse ${} in JSP page
- <script id="clientTemplate" type="text/html">
- <li><a href="clients/${id}">${name}</a></li>
- </script>
<script id="clientTemplate" type="text/html"><li><a href="clients/${id}">${name}</a></li></script>
进行转义后
- <script id="clientTemplate" type="text/html">
- <li><a href="clients/${'${'}id}">${'${'}name}</a></li>
- </script>
<script id="clientTemplate" type="text/html"><li><a href="clients/${'${'}id}">${'${'}name}</a></li></script>
2. save jQuery template as separated file and disable its EL evaluation
if you have a lot of jQuery templates, it's better to extract them out to a seperated file. 不使用el表达式
- <%@ page isELIgnored="true" %>
- <script id="clientTemplate" type="text/html">
- <li><a href="clients/${id}">${name}</a></li>
- </script>
- <script id="anotherTemplate" type="text/html">
- <li><a href="clients/${id}">${name}</a></li>
- </script>
<%@ page isELIgnored="true" %><script id="clientTemplate" type="text/html"><li><a href="clients/${id}">${name}</a></li></script><script id="anotherTemplate" type="text/html"><li><a href="clients/${id}">${name}</a></li></script>
Then include this file in your JSP pages need template:
- <jsp:include page="jqTemplate.jsp"></jsp:include>
<jsp:include page="jqTemplate.jsp"></jsp:include>
http://www.infoq.com/cn/news/2010/10/DataLink-jQuery Data Link:jQuery的数据绑定插件
http://code.google.com/p/jquery-utils/ jquery 工具集, 包含字符串格式化处理, cookie, 数组, 国际化处理.
- jsp里的${}和jquery template的${} 怎么样转义
- jsp里的${}和jquery template的${} 怎么样转义
- jsp的转义字符
- JSP的转义字符
- JSP的转义字符
- 关闭django template的自动转义
- jquery的//转义
- HTML里的转义字符
- python里使用string.Template实现自定义转义字符和正则表达式替换
- jquery的template模版功能
- C++primer里的template的用法
- 常见的xml里的转义字符
- C++ primer里的template用法
- perl里split的转义问题
- Java里Html转义的工具
- iOS 去除JSON里的转义符
- iOS 去除JSON里的转义字符
- Java里常用的转义字符
- 文本 字符编码
- 【Zigbee】IAR基本配置(陆续添加)
- LABjs浅析
- Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
- ScheduledThreadPoolExecutor
- jsp里的${}和jquery template的${} 怎么样转义
- 大规模系统的系统架构
- php 字符串整型转换
- MySQL root密码登陆失败
- jQuery Pagination插件简介
- U-Boot启动过程完全分析
- 数据结构—单链表的操作
- js获取客户端IP及地理位置
- mysql 同一值对应多值的数据检索SQL