更新时间:2016年09月29日16时52分 来源:传智播客JAVA培训学院 浏览次数:
package cn.itcast.fn; public class MyFunction { public static String print(){ return "创智播客之EL函数库"; } } |
<?xml version="1.0" encoding="UTF-8" ?> <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>itcast</description> <display-name>itcast-function</display-name> <tlib-version>1.0</tlib-version> <short-name>it</short-name> <uri>http://www.itcast.cn/el/functions</uri> <function> <name>print</name> <function-class>cn.itcast.fn.MyFunction</function-class> <function-signature>java.lang.String print()</function-signature> </function> </taglib> |
<function> <description> Tests if an input string contains the specified substring. </description> <name>contains</name> <function-class>org.apache.taglibs.standard.functions.Functions</function-class> <function-signature>boolean contains(java.lang.String, java.lang.String)</function-signature> <example> <c:if test="${fn:contains(name, searchString)}"> </example> </function> |
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="it" uri="/WEB-INF/tlds/itcast.tld" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <h1>${it:print() }</h1> </body> </html> |