httl拖链与jstl谁的性能最好

HTTL - 开源Java模板引擎
HTTL开发团队
根据2.0版本Apache许可证(以下简称"许可证")授权;
根据本许可证,用户可以不使用此文件。
用户可从下列网址获得许可证副本:
http://www.apache.org/licenses/LICENSE-2.0
除非因适用法律要求或书面同意,
根据本许可证分发的软件是基于"按原样"基础提供的,
无任何明示的或暗示的保证或条件。
详见根据本许可证许可下特定语言的管辖权限和限制。
缺省配置下,HTTL不需要依赖任何三方类库即可运行。
最新稳定版本为:1.0.11,发布于:,欢迎使用。
该版本主要修复用户发现的问题,参见:
HTTL核心包
Script集成包
Servlet集成包
SpringMVC集成包
Struts集成包
WebX集成包
JFinal集成包
Nutz集成包
Servlet示例
SpringMVC示例
Struts示例
JFinal示例
已发布到Maven中央库:
&dependencies&
&dependency&
&groupId&com.github.httl&/groupId&
&artifactId&httl&/artifactId&
&version&1.0.11&/version&
&/dependency&
&dependency&
&groupId&com.github.httl&/groupId&
&artifactId&httl-script&/artifactId&
&version&1.0.11&/version&
&/dependency&
&dependency&
&groupId&com.github.httl&/groupId&
&artifactId&httl-servlet&/artifactId&
&version&1.0.11&/version&
&/dependency&
&dependency&
&groupId&com.github.httl&/groupId&
&artifactId&httl-springmvc&/artifactId&
&version&1.0.11&/version&
&/dependency&
&dependency&
&groupId&com.github.httl&/groupId&
&artifactId&httl-struts&/artifactId&
&version&1.0.11&/version&
&/dependency&
&dependency&
&groupId&com.github.httl&/groupId&
&artifactId&httl-webx&/artifactId&
&version&1.0.11&/version&
&/dependency&
&dependency&
&groupId&com.github.httl&/groupId&
&artifactId&httl-jfinal&/artifactId&
&version&1.0.11&/version&
&/dependency&
&dependency&
&groupId&com.github.httl&/groupId&
&artifactId&httl-nutz&/artifactId&
&version&1.0.11&/version&
&/dependency&
&/dependencies&
将war包放到:tomcat/webapps/httl-springmvc-demo-1.0.11.war,并启动tomcat,
然后访问:http://localhost:8080/httl-springmvc-demo-1.0.11
可以用同样的方式,导入MVC集成示例源码。
下载主干源码:
git clone /httl/httl.git
或者,直接下载各版本Tag包,并解压:
wget /httl/httl/archive/1.0.11.zip
unzip httl-1.0.11.zip -d httl-1.0.11
cd httl-1.0.11
编译源码:
mvn install -Dmaven.test.skip
生成Eclipse工程描述文件:
mvn eclipse:eclipse -DdownloadSources
导入Eclipse工程:
Eclipse -& File -& Import -& Existing Projects into Workspace -& Browse -& Finished
将.httl文件以html编辑器格式打开:
Eclipse -& Window -& Preferences -& General -& Content Types -& Text -& HTML -& Add -& *.httl
安装Maven命令行:(用于支持上面的mvn命令)
wget http://www.apache.org/dist//maven/binaries/apache-maven-2.2.1-bin.tar.gz
tar zxvf apache-maven-2.2.1-bin.tar.gz
export PATH=$PATH:apache-maven-2.2.1/bin
下载 http://www.apache.org/dist//maven/binaries/apache-maven-2.2.1-bin.tar.gz
解压 apache-maven-2.2.1-bin.tar.gz
桌面 -> 我的电脑 -> 右键菜单 -> 系统属性 -> 高级 -> 环境变量 -> 在PATH变量中加入apache-maven-2.2.1/bin目录。
forbid.method出错
dump数据为空时,不生成空文件
trimBlankLine下标越界
velocity兼容解析空白和$处理
公开字段无法直接使用
所有类型支持与String等号对比
MVC集成在getTemplate时传入初始数据类型
不知道这是bug还是不稳定?缓存jsp都没这样的问题!
Javassist调用公共宏出现方法重载错误
关于log的问题
#for中文冒号出错信息不友好
MVC集成缺省关闭output.writer
使用HTTL整数相等判断不正确
precompiled改成preload
打开debug模式,控制台会报错。和fastjson版本有关?
第一次加载页面,解析比较慢,而且我打开预编译,日志显示找到0个模板
部署httl-servlet-demo-1.0.10.war项目后,访问的时候找不到类
获取模板时传入模板变量以获取类型
模板目录没配ClassPath预编译空指针
删除空行问题 bug
jndi无法预加载
支持#for(9)单数字循环次数
增加#for(menu : menus.recursive)树递归方法
增加属性语法ifattr和setattr支持
增加#macro($list=>cache)宏输出过滤支持
增加JFinal集成
增加Nutz集成
TemplateParser.clean有问题,导致丢失合并后的第一个指令
移除空白行问题
修复message.directory问题
if(B+C==A)出错
带://协议头的目录前面不加/根目录符
1.0.9版本#set不支持逗号分隔多个赋值语句
escapeXml(byte[])遇到中文出错
ExpressionParser中反单引号escape没有生效
宏定义有多个参数时,若不指定参数类型,调用时参数顺序会乱掉。
modes=debug时会报空指针异常
将Resource的getReader改成openReader
注释两边可带空格
1. 增加Visitor,可以遍历模板语法树。
2. 增加解释执行,以及解释编译混合执行。
3. for循环支持java写法
4. for循环支持else
5. 增加ArrayMapConverter
6. 可配置forbid.methods禁止调用的方法名
7. 在#for之外的#break可以打断模板和宏
8. 支持is操作符,与instanceof相同
9. 增加code.directory存放解析生成的java代码
10. 支持配置多个模板目录,用逗号分隔
11. 配置位置支持classpath等前缀
12. 支持字面Boxed数字,3L生成java.lang.Long类型
13. 配置+=追加在缺省配置之前
14. OutputStreamTemplate传入Writer报错,而不是转换
15. 提示#var变量名不能包含点号
16. 遇到模板类型自动不过滤
17. 表达式不暴露为API,删除evaluate方法
18. sequences改成import.sequences
19. 将生成编译的代码改成AST树访问者组装
20. 不识别的指令忽略
21. 异常信息中给出HTTL的版本
22. getVariables返回没有定义类型的变量
23. 生产模式时,在内存中不保存模板源文件
24. 修复#set和#for变量泛型问题
25. 解决String[]声明的时候报错的问题
26. 解决JdkCompiler的ClassPath查找BUG
27. 修复参数为基本类型时无法找到对应方法问题
28. 对于没有返回值及不需要取得返回值的方法调用支持问题
29. 修复set指令识别上溯造型的问题
30. Macro中super.fooMethod不能调用有参数的方法
31. 宏单独编译后行号与原始模板没有对应
32. 解决字面包名的解析问题
1. 统一使用#set指令,但保持兼容
2. 支持将Velocity语法Filter成Httl语法
3. 支持dump运行时上下文数据
4. 增加use.render.variable.type配置
5. 增加import.sizers配置
6. 增加modes=dev模式配置
7. 增加logger.level配置
8. 将java.version配置改成compile.version
9. 支持从JVM的-D参数和系统的环境变量读取配置
10. 配置允许用减等于去除缺省配置部分值
11. 将Comment和Attribute语法的处理改为Filter实现
12. Context的创建过程由Engine完成
13. Context所有方法检查跨线程调用
14. 重构Codec继承于Formatter
15. 修复字符串中有}号,表达式解析错误
16. 修复javassist的for 1..3编译不过
17. 修复内置JSON解析Bean类型转换问题
18. 修复message.directory拼接错误
1. 允许用户不用声明#set()类型,而在运行时通过getTemplate()参数指定。
2. 将调用writer.write(String)改成调用writer.write(char[]),减少Writer中的char[]拷贝。
3. 将filter(String)改成filter(char[])和filter(byte[]),优化二进制输出时过滤性能。
4. 将format()改成toChars()和toBytes(),优化二进制输出时格式化性能。
5. 全部改为使用StringUtils判断空串。
6. 传入configPath为空时自动设为缺省路径。
7. 增加response.encoding配置项,用于自动设置响应编码。
8. 只要类型相同,允许重复定义变量类型。
9. 增加template.filters和expression.filters配置项,用于过滤模板和表达式源。
10. 增加模型Converter接口,允许传入对象属性作为参数,而不用转换Map。
11. 增加输出Converter接口,允许传入response等类,根据配置自动转成Writer或OutputStream。
12. 重构WebEngine,使其只负责创建Engine,而不带任何render逻辑,减少硬编码。
13. 将default.parameter.type改成default.variable.type,以免和servlet的parameter混淆,并修复没有生效的问题。
14. 将default.variable.type缺省设为java.lang.Object,不用运算的变量就不用声明类型,可以直接输出${obj}。
15. 凡是有get(str),getProperty(str),getAttribute(str)方法的对象,都可以直接用${obj.str}访问。
16. MVC集成增加自动导入cookie,parameter,header三个Map变量,用户可以${parameter.aaa}或${header.userAgent}
17. 修复出错位置信息偏移一位的问题。
18. char[]不转成String,直接过滤输出。
19. 增加import.getters+=getAttribute配置,则${aa.bb}将调用aa.getAttribute("bb")
20. lint.chekced改为配置是否在出错后开启。
21. Switcher接口改为泛型,可同时切换Filter和Formatter。
22. BeanFactory支持@Reqiured属性禁止加载,比如没配extends.default,则不加载ExtendsInterceptor。
23. 注释符号可配置,比如将模板用于生成Java代码时,可配成:comment.left=/* 和 comment.right=*/。
24. 支持多个模板后缀,比如:template.suffix=.httl,.html
25. 解决在指令省略括号时,误将(a + b) * (c + d)两边的括号给去掉了,导致表达式解析出错。
26. 支持和Velocity一样的无注释符语法,比如:#if(a == b) ... #end
27. 增加JsonMapConverter和StringBuilderOutConverter。
28. 允许#set(formatter = formatter.add($myFormatter))
29. #set(filter = $myFilter)
30. 支持Codec扩展,并内置JSON编解码实现。
1. 将$!{extend("/layout.httl")改成$!{extends("/layout.httl")} // 多了个s,因为大家习惯用加s的extends
2. 将$!{parent.template.macros.foo}改成$!{super.foo} // 就像Java里覆盖方法调父类的同名方法一样。
3. 支持模板CoC自动继承,使用户不用在每个模板中写extends语句。
4. 将set(a = b)回写到context中,使语义符合直觉,增加set(a .= b)表示只在当前模板使用,对子模板隐藏的变量。
5. 允许用户设置缺省变量类型default.parameter.type=String,var中未声明的类型,使用缺省类型,减少var声明。
6. 增加拦截器和监听器扩展接口,使扩展者可以在模板渲染前后插入逻辑。
7. 当#end与启始指令数不匹配时,显示#end所在位置。
8. evaluate和render增加抛出ParseException,以免嵌套异常丢失位置信息。
9. 解决宏内再包含宏时解析出错问题。
10. 内置Web集成,将output.encoding设置给response,使输出保持一致,防止乱码。
11. 将context.getOutput()改为context.getOut()与JDK和JSP命名一致。
12. 内置MVC集成,将请求属性的读取放在递归完context.parent之后,与MVC的常规约定保持一致。
13. 增加ScriptEngine集成,用户可以通过JDK标准的Script接口调用HTTL。
修复问题:
1. 修复数组参数为null时下标取值空指针,以及大Boolean的null处理,并增加全部传入null值的测试。
2. 解决反射获取session变量失败问题。
3. 解决参数报错所在列号错误问题。
4. 解决重复变量声明时报错不友好问题,并增加异常信息断言测试用例。
5. 解决AdaptiveTemplate.getMacros()没有进行适配的问题,导致stream和writer模板互相引用。
6. 修复list()没有递归查找子目录文件,导致precompiled失效问题。
7. 修复+=追加配置在父配配置为空时,配置值丢失问题。
8. 修复:=赋值没有设到context.parent中,导致用户不能在模板渲染之后获取变量。
兼容优化:
9. 将macro的赋值从render()方法移动构造函数,以提升性能。
10. include等支持../相对路径。
11. 一元!否定和||或运算符支持string和list
12. 允许通过this访问模板本身,比如:${this.name} ${this.encoding}
13. 只有用到的变量才生成context.get()语句,没用到的var忽略,以提升性能。
不兼容优化:
14. 将i18n改成message,与jstl,springmvc等命名一致,影响使用国际化功能的模板。
15. 增加#{expression}表示编译期执行占位符,比如编译期国际化信息或文件嵌入:#{message("foo")}
16. 增加locator扩展点,允许用户在不修改loader的情况下,改变查找资源的位置,建立mapping关系。
17. 增加集合排序方法:map.sort,collection.sort,array.sort。
18. 增加名称转换方法:str.toCamelName,str.toCapitalName,str.toUnderlineName。
19. 增加编码方法:str.toMd5,str.toSha,str.toBase64,str.parseBase64。
20. 增加文本序列化方法:str.parseJson,obj.toJson,str.parseXml,obj.toXml,需配置fastjson和xstream依赖。
21. 增加import.variables导入参数,用户可以像JSP一样使用request,response,session等隐式参数。
22. 增加$!{extend("/layout.httl")}模板继承功能,用子模板中的宏替换父模板中的同名称进行输出。
23. 属性语法支持将属性写到注释中,以方便在没有标签的地方执行,如:&!--if="a == b"--&&!--end="if"--&
24. 支持根据变量所在位置,使用不同的Filter,并增加Switcher扩展点,可自定义位置的切换。
1. 修复生成模板类源码数组类型名称问题。
2. 单引号为字符串,反单引号为char。
3. 生成的模板类代码只打印在日志,不放到异常信息中。
4. 自动删除指令行空白,并可通过remove.directive.blank配置。
5. 多Resolver和多Loader反序查找,便于+=配置,用户配置优先。
6. set支持用分号分隔多个赋值。
7. for状态的stcak集合改成parent链。
8. 清理所有Array.get()反射。
9. ClassUtils增加属性反射缓存。
10. 允许分开设置template.cache.capacity和expression.cache.capacity。
11. 修复生成Java代码时,部分方法调用没有生成null判断。
12. read,include应根据output类型自适应返回byte[]或String。
13. 增加byte[]和char[]的toString处理。
14. 增加string.split(char)方法。
15. 增加Object弱类型参数运行时byte[]判断,以免被format()成String,再转回byte[]输出。
16. 打印配置和模板加载目录INFO日志,方便排错。
17. 解决Engine的properties后于init()方法赋值问题。
18. 修复set重复定义变量类型,导致JdkCompiler编译失败的问题。
19. 国际化信息找不到时,显示Key。
20. 改为从模板相同的Loader加载国际化信息。
21. 改为使用EncodingProperties加载国际化信息,用户可以直接用UTF-8文件保存国际化信息,而不需要ascii2native。
22. 所有Web集成不再需要在web.xml和httl.properties中配置ServletLoader,缺省自动配置。
23. 修复Compiler类元重复编译导至类元信息泄漏的问题。
1. java.version配置项缺省改为自动获取当前JDK的版本。
2. 修复precompiled注入顺序问题。
3. 修复跨配置文件的$配置项引用问题。
4. 增加ByteCache,减少生成字节码逻辑。
5. 检查锁逃逸,ByteOutput换成UnsafeByteOutput,StringBuffer换成StringBuilder等。
6. 在$!{foo}进行不过滤输出时,如果变量本身就是byte[]或String类型,直接向stream或writer输出,减少转码。
7. 增强集合运算后泛型推导,比如:#for(book : booklist1 + booklist2)。
8. 改用google的ConcurrentLinkedHashMap做LRU缓存实现。
9. 支持集合相加,比如:array1 + array2, list1 + list2, map1 + map2。
10. 缺省导入java.lang.Math中的静态方法。
11. 增加hasResource()判断资源是否存在。
12. 增加Resolver扩展接口,用于获取运行时属性,比如请求的国际化区域信息和请求的编码。
13. 增加"foo".message()方法查找ResourceBunlde国际化信息,如:message_zh_CN.properties。
14. 增加"foo.httl".locale()方法查找国际化文件名,如:foo_zh_CN.httl。
1. 修复压测下${evaluate("1 + 2")}动态编译出现大量编译问题,以及perm区增长问题,增加类及实例缓存。
2. 修复压测下WrappedMap过多实例化问题,延迟到Context.getParameters()被调用时再创建。
3. 修复压测下StringUtils.escapedHtml()在长字符串下会导致StringBuilder的数组拷贝问题,改为new StringBuilder(len * 2)。
4. 修复压测下ClassUtils.forName()占用较多时间问题,增加Map缓存。
5. 修复ClassUtils.forName()不支持多维数组问题。
6. 修复压测下DateFormat查找稍慢的问题,为缺省格式的DateFormat增加独立的ThreadLocal,减少按格式查询Map缓存。
7. 修复AbstractTemplate的serialize没有使用配置的字符编码问题。
8. 修复a(b())一元函数解析错误的问题。
9. 配置文件增加支持a=$b引用其它配置项。
10. 增加ClearBlankLineFilter用于清除静态文本中的空白行。
11. 增加${render($template)}动态模板求值。
12. 修复Loader加载时目录拼接错误。
1. 增加springmvc的ViewResolver集成。
2. 增加struts的Result和TemplateEngine集成。
3. 增加webx的TemplateEngine集成。
4. 增加slf4j日志输出,并设为缺省。
5. 增加jcl日志输出。
6. 增加set(a := b),用于将参数写回Context的参数Map中。
7. 允许include传参,如:$!{include("aaa.httl", ["user": user,"age": 28])}
8. 优化unescapeString和unescapeHtml的性能。
修复问题:
1. 解决for和if/else联合使用时状态错乱问题。
2. 解决getIsXxx属性解析出错问题。
3. 解决文件加载未使用指定编码问题。
4. 解决部分文件流打开后未关闭问题。
5. 解决迭代map出错的问题,以及Map数据的类型推断问题。
6. 支持单独的macro文件定义宏方法,通过import.macros配置加载。
7. 增加gt,ge,lt,le符号,在属性语法时避免表达式出现HTML标签符。
兼容优化:
8. 静态方法不走engine.getFunction()查找实例,直接调用类的静态方法。
9. 将所有配置的获取改为setter注入,比如:setInputEncoding(String)。
10. 编译Macro时直接注入到模板属性中,并增加template.getMacros()方法。
11. 渲染过程不改变传入Map的状态,保证模板渲染的无副作用性,以及多次渲染的幂等性。
12. 优化Profiler性能分析发现的ArrayIterator引起的性能损耗问题。
13. 将文本内容不编译到字节码中,改为从缓存中获取,防止内存Perm区过大,并提供source.in.class和text.in.class开关项。
不兼容优化:
14. 将define指令名改成var,以免和velocity的define指令理解混淆,影响所有旧模板,用户可全文替换。
15. 去掉block指令,用#set(xxx = xxxmacro())代替,影响使用block的模板。
16. 将com.googlecode.httl改成httl,影响API调用,重新Ctrl+Shift+O导入一下包名即可,类名没变。
17. 将com.googlecode.httl.support改成httl.spi,影响httl.properties中扩展点的配置,使用缺省配置值的,建议不要配到用户配置中。
18. 将filters配置项改成了value.filters,与text.filters对应用,影响httl.properties中filter扩展点的配置。
19. 将functions配置项成了import.methods,与import.packages以及import.macros对应,方便理解。
20. 加号数字优先,即只要有一方为数字即换数字计算,如:"2" + 3,输出:5,而不是:23,如果要字符相拼双方都要为字符:"2" + 3.toString
1. 增加注释语法并设为缺省,如:&!--#if(...)--&
2. 支持热加载,当文件变更时,自动重新加载,配置:reloadable=true
3. 支持启动时预编译,配置:precompiled=true
4. 异常信息显示出错位置周边内容,更容易排错
5. 支持注释块,不解释块,特殊符转义,如:\#, \$
6. 支持include,read,evaluate函数(可自行扩展),如:${include("xxx.httl")]
7. 支持集合泛型参数,如:#define(List&Book& books)
8. 自动空指针检测,比如:${user.role},当user为null时不会空指针
9. 自动条件补全,比如:#if(books)等价于#if(books != null && books.size & 0)
10. 支持for状态栈,多层for时,可通过${for.parent.index}获取上层for状态
11. 允许设置for状态变量名
12. 支持方括号数组,如:#for(c : [a, b, c])
13. 支持双点号序列,如:#for(c : a..c)或#for(i : 1..2)或#for(day :"Monday".."Sunday")
14. 支持集合或运算,选择不为空的集合,如:#for(book : books1 | books2)
15. 支持Date类型比较,如:#if(date1 & date2)
16. 支持new操作,如:${new Date()}
17. 支持强制转型,如:#set(user = (User) param)
18. 增加HttlServlet,支持将请求经过MVC框架处理并填充request属性后forward到HttlServlet进行页面渲染
19. 兼容JDK1.5,需配置:compiler=com.googlecode.pilers.JavassistCompiler
第一个版本,基本功能实现,HTML属性语法解析。
从以前的CommonTemplate中迁移。
| 中文JSP Standard Tag Library (JSTL) Tutorial
JSP - Standard Tag Library (JSTL) Tutorial
Advertisements
In this chapter, we will understand the different tags in JSP. The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates the core functionality common to many JSP applications.
JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags. It also provides a framework for integrating the existing custom tags with the JSTL tags.
Install JSTL Library
To begin working with JSP tages you need to first install the JSTL library. If you are using the Apache Tomcat container, then follow these two steps &
Step 1 & Download the binary distribution from
and unpack the compressed file.
Step 2 & To use the Standard Taglib from its Jakarta Taglibs distribution, simply copy the JAR files in the distribution's 'lib' directory to your application's webapps\ROOT\WEB-INF\lib directory.
To use any of the libraries, you must include a &taglib& directive at the top of each JSP that uses the library.
Classification of The JSTL Tags
The JSTL tags can be classified, according to their functions, into the following JSTL tag library groups that can be used when creating a JSP page &
Formatting tags
JSTL Functions
The core group of tags are the most commonly used JSTL tags. Following is the syntax to include the JSTL Core library in your JSP &
&%@ taglib prefix = "c" uri = "/jsp/jstl/core" %&
Following table lists out the core JSTL Tags &
Tag & Description
Like &%= ... &, but for expressions.
Sets the result of an expression evaluation in a 'scope'
Removes a scoped variable (from a particular scope, if specified).
Catches any Throwable that occurs in its body and optionally exposes it.
Simple conditional tag which evalutes its body if the supplied condition is true.
Simple conditional tag that establishes a context for mutually exclusive conditional operations, marked by &when& and &otherwise&.
Subtag of &choose& that includes its body if its condition evalutes to 'true'.
Subtag of &choose& that follows the &when& tags and runs only if all of the prior conditions evaluated to 'false'.
Retrieves an absolute or relative URL and exposes its contents to either the page, a String in 'var', or a Reader in 'varReader'.
The basic iteration tag, accepting many different collection types and supporting subsetting and other functionality .
Iterates over tokens, separated by the supplied delimeters.
Adds a parameter to a containing 'import' tag's URL.
Redirects to a new URL.
Creates a URL with optional query parameters
Formatting Tags
The JSTL formatting tags are used to format and display text, the date, the time, and numbers for internationalized Websites. Following is the syntax to include Formatting library in your JSP &
&%@ taglib prefix = "fmt" uri = "/jsp/jstl/fmt" %&
Following table lists out the Formatting JSTL Tags &
Tag & Description
To render numerical value with specific precision or format.
Parses the string representation of a number, currency, or percentage.
Formats a date and/or time using the supplied styles and pattern.
Parses the string representation of a date and/or time
Loads a resource bundle to be used by its tag body.
Stores the given locale in the locale configuration variable.
Loads a resource bundle and stores it in the named scoped variable or the bundle configuration variable.
Specifies the time zone for any time formatting or parsing actions nested in its body.
Stores the given time zone in the time zone configuration variable
Displays an internationalized message.
Sets the request character encoding
The JSTL SQL tag library provides tags for interacting with relational databases (RDBMSs) such as Oracle, mySQL, or Microsoft SQL Server.
Following is the syntax to include JSTL SQL library in your JSP &
&%@ taglib prefix = "sql" uri = "/jsp/jstl/sql" %&
Following table lists out the SQL JSTL Tags &
Tag & Description
Creates a simple DataSource suitable only for prototyping
Executes the SQL query defined in its body or through the sql attribute.
Executes the SQL update defined in its body or through the sql attribute.
Sets a parameter in an SQL statement to the specified value.
Sets a parameter in an SQL statement to the specified java.util.Date value.
Provides nested database action elements with a shared Connection, set up to execute all statements as one transaction.
The JSTL XML tags provide a JSP-centric way of creating and manipulating the XML documents. Following is the syntax to include the JSTL XML library in your JSP.
The JSTL XML tag library has custom tags for interacting with the XML data. This includes parsing the XML, transforming the XML data, and the flow control based on the XPath expressions.
&%@ taglib prefix = "x"
uri = "/jsp/jstl/xml" %&
Before you proceed with the examples, you will need to copy the following two XML and XPath related libraries into your &Tomcat Installation Directory&\lib &
XercesImpl.jar & Download it from
xalan.jar & Download it from
Following is the list of XML JSTL Tags &
Tag & Description
Like &%= ... &, but for XPath expressions.
Used to parse the XML data specified either via an attribute or in the tag body.
Sets a variable to the value of an XPath expression.
Evaluates a test XPath expression and if it is true, it processes its body. If the test condition is false, the body is ignored.
To loop over nodes in an XML document.
Simple conditional tag that establishes a context for mutually exclusive conditional operations, marked by &when& and &otherwise& tags.
Subtag of &choose& that includes its body if its expression evalutes to 'true'.
Subtag of &choose& that follows the &when& tags and runs only if all of the prior conditions evaluates to 'false'.
Applies an XSL transformation on a XML document
Used along with the transform tag to set a parameter in the XSLT stylesheet
JSTL Functions
JSTL includes a number of standard functions, most of which are common string manipulation functions. Following is the syntax to include JSTL Functions library in your JSP &
&%@ taglib prefix = "fn"
uri = "/jsp/jstl/functions" %&
Following table lists out the various JSTL Functions &
Function & Description
Tests if an input string contains the specified substring.
Tests if an input string contains the specified substring in a case insensitive way.
Tests if an input string ends with the specified suffix.
Escapes characters that can be interpreted as XML markup.
Returns the index withing a string of the first occurrence of a specified substring.
Joins all elements of an array into a string.
Returns the number of items in a collection, or the number of characters in a string.
Returns a string resulting from replacing in an input string all occurrences with a given string.
Splits a string into an array of substrings.
Tests if an input string starts with the specified prefix.
Returns a subset of a string.
Returns a subset of a string following a specific substring.
Returns a subset of a string before a specific substring.
Converts all of the characters of a string to lower case.
Converts all of the characters of a string to upper case.
Removes white spaces from both ends of a string.
& Copyright 2017. All Rights Reserved.}

我要回帖

更多关于 httl拖链 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信