velocity配置文件中的编码配置类:
//对html文件编码的配置
org.apache.velocity.app.event.implement.EscapeHtmlReference
//对javascript文件编码的配置
org.apache.velocity.app.event.implement.EscapeJavascriptReference
//对sql文件编码的配置
org.apache.velocity.app.event.implement.EscapeSqlReference
//对xml文件编码的配置
org.apache.velocity.app.event.implement.EscapeXmlReference
1:在velocity.properties中配置全局变量转义:
default.contentType=text/html; charset=UTF-8
input.encoding=UTF-8
output.encoding=UTF-8
eventhandler.referenceinsertion.class = org.apache.velocity.app.event.implement.EscapeHtmlReference
eventhandler.referenceinsertion.class = org.apache.velocity.app.event.implement.EscapeSqlReference
eventhandler.escape.html.match = /msg.*/
eventhandler.escape.sql.match = /sql.*/
2:在velocity.properties中配置局部变量转义:
default.contentType=text/html; charset=UTF-8
input.encoding=UTF-8
output.encoding=UTF-8
eventhandler.referenceinsertion.class = org.apache.velocity.app.event.implement.EscapeHtmlReference
eventhandler.referenceinsertion.class = org.apache.velocity.app.event.implement.EscapeSqlReference
eventhandler.escape.html.match = /_html_*/
eventhandler.escape.sql.match = /_sql_*/
前台数据显示时 要转义的数据变量名定义需遵循:
格式:_html_自定义名字
例如:_html_title、_html_userName等等
分享到:
相关推荐
Velocity模板引擎Velocity模板引擎Velocity模板引擎Velocity模板引擎Velocity模板引擎Velocity模板引擎Velocity模板引擎Velocity模板引擎Velocity模板引擎Velocity模板引擎
Velocity.js 是velocity模板语法的javascript实现。Velocity 是基于Java的模板引擎,广泛应用在阿里集 体各个子公司。Velocity模板适用于大量模板使用的场景,支持复杂的逻辑运算,包含 基本数据类型、变量赋值和...
Velocity模板引擎 v2.2.0.zip
测试报告模板+guice-3.0.jar+reportng-1.1.6.jar+velocity-dep-1.4.jar
Java的模板引擎Velocity初体验.pdf
velocity-tools-2.0.jar velocity-tools-2.0.jar velocity-tools-2.0.jar velocity-tools-2.0.jar velocity-tools-2.0.jar
加载附加的国际化属性文件(不包含.properties后缀) struts.custom.properties Location of additional configuration properties files to load 加载附加的配置文件的位置 struts.devMode Whether Struts ...
Velocity的基本语法:1.变量 2.循环 3.条件语句 4.语句的嵌套 5.注释 .....
velocity-dep-1.4.jar velocity-dep-1.4.jar
velocity-1.7-dep.jar.zip velocity-1.7-dep.jar.zip velocity-1.7-dep.jar.zip
Velocity模板技术语法详细介绍,包括很详细的示例代码 1.变量………………………………………………………………………………1 2.循环………………………………………………………………………………2 3.条件语句...
梯形、余弦、多项式、7段S型、7段修正S型、15段S型、31段S型速度规划演示软件。采用统一架构实现了以上7种速度规划算法,所有核心算法均用c语言实现,不调用第三方算法库,采用QT实现图形用户界面。
使用velocity.js开发序列动画,需要同时引入velocity.ui.min.js库文件
2.什么是Velocity. 3 3.Velocity能为你做什么. 3 1.一个Mud Store Example. 3 4.Velocity Template Language (VTL) 介绍... 4 5.输出第一个VTL页面!. 4 6.Comments(注释). 5 7.References(引用)5 1.Variables(变量)....
velocity-engine-core-2.1.jar
《Velocity模板使用指南中文版》.doc。。。。。。。。。。。。。。。。。
Velocity是一个基于java的模板引擎(template engine)。它允许任何人仅仅简单的使用模板语言(template language)来引用由java代码定义的对象。 当Velocity应用于web开发时,界面设计人员可以和java程序开发人员...