${name}
- 全域查找
- pageContext --> request --> session --> application
${sessionScope.name} //指定域查找
${pageScope.name}
${requestScope.name}
${applicationScope.name}
javaBean导航(map也是可以这样操作的)
${object.name}
${map['key']}
EL函数库(jstl提供)
自定义函数库
java类 静态方法
- 创建java类
package com.suse.yuxin.tags;
public class TestTag {
public static String getName(){
return "name";
}
}
- 创建tld文件 并放到WEB-INF/下面
<taglib
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
<description>JSTL 1.1 functions library</description>
<display-name>JSTL functions</display-name>
<tlib-version>1.1</tlib-version>
<short-name>fn</short-name>
<uri>http://java.sun.com/jsp/jstl/xxxcdsds</uri>
<function>
<name>getName</name>
<function-class>com.suse.yuxin.tags.TestTag</function-class>
<function-signature>java.lang.String getName()</function-signature>
</function>
</taglib>
- jsp导入标签并使用
<%@ taglib prefix="my" uri="/WEB-INF/tlds/nametls.tld" %>
${my:getName()}
Nothing is certain in this life. The only thing i know for sure is that. I love you and my life. That is the only thing i know. have a good day
网友评论