自定义el函数
来源:互联网 发布:破获特大网络售假药案 编辑:程序博客网 时间:2024/06/06 18:54
JSTL的Functions标签库提供的函数有限,如果需要,可以自行开发el函数。
Function.java:
public class Function {public static String makeSecondUpperCase(String str){return str.substring(0,1)+str.substring(1,2).toUpperCase()+str.substring(2);}public static String cutLastChar(String str){return str.substring(0,str.length()-1);}}myfn.tld:
<?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>JSTL 1.1 functions library</description> <display-name>JSTL functions</display-name> <tlib-version>1.1</tlib-version> <short-name>f</short-name> <uri>www.dragon.com</uri> <function> <name>makeSecondUpperCase</name> <function-class>com.function.Function</function-class> <function-signature>String makeSecondUpperCase(java.lang.String)</function-signature> </function> <function> <name>cutLastChar</name> <function-class>com.function.Function</function-class> <function-signature>String cutLastChar(java.lang.String)</function-signature> </function> </taglib>test.jsp:
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%><%@ taglib prefix="func" uri="www.dragon.com" %><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title></head><body>${func:makeSecondUpperCase("abcdefg")}<br>${func:cutLastChar("abcdefg")}</body></html>
- 如何自定义EL函数
- EL自定义函数
- el自定义函数
- JSP自定义EL函数
- EL自定义函数
- 自定义EL函数
- EL表达式-自定义函数
- EL表达式-自定义函数
- 自定义el函数
- EL自定义函数
- 自定义EL函数
- EL自定义函数
- EL自定义函数
- 自定义EL函数
- 自定义EL函数
- EL表达式-自定义函数
- 自定义EL函数
- 自定义el函数
- Linux下的二进制文件比较工具
- 破解红蜘蛛 (破解红蜘蛛多媒体网络教室) 解除老师控制
- 补充 查看python安装位置
- Servlet高级应用----缓存设置
- Java定时器
- 自定义el函数
- c++类的三种继承方式的区别
- 网络安全基础篇之<十五>
- 基于堆实现的优先级队列:PriorityQueue 解决 Top K 问题
- DLL编写(VC,孙鑫MFC教程笔记)
- UIScrollView的属性总结
- orace 命令
- git blame
- 最原始网站回归网络