jstl自定义函数
来源:互联网 发布:广电网络维护员 编辑:程序博客网 时间:2024/04/30 04:36
1.自定义函数类
package com.dq.oa.web;
import com.dq.oa.manager.ACLManager;
/**
* jstl 函数 ,主要功能计时认证
* */
public class SecurityFunctions {
private static ACLManager aclManager;
public static boolean hasPermission(int userId, String reourceSn,
int permission) {
return aclManager.hasPermissionByResourceSn(userId, reourceSn,
permission);
}
// 不可以是静态的静态的spring注入不进去
public ACLManager getAclManager() {
return aclManager;
}
public void setAclManager(ACLManager aclManager) {
SecurityFunctions.aclManager = aclManager;
}
}
2编写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">
<tlib-version>1.0</tlib-version>
<short-name>my</short-name>
<uri>http://www.dq.com/oa/functions</uri>
<function>
<name>hasPermission</name>
<function-class>com.dq.oa.web.SecurityFunctions</function-class>
<function-signature>boolean hasPermission(int, java.lang.String,int)</function-signature>
</function>
</taglib>
3.在jsp文件中调用
<c:if test="${my:hasPermission(login.id,'person',3)}">
<a href="#"
onclick="del('person.do?method=del&id=${person.id }')">删除</a> |
</c:if>
- 自定义jstl函数、自定义jstl标签
- 自定义JSTL函数
- 自定义JSTL函数
- 自定义JSTL函数
- 自定义JSTL函数
- 自定义JSTL函数
- jstl自定义函数
- 自定义JSTL函数
- 自定义JSTL函数
- jstl-自定义函数
- 自定义JSTL函数
- JSTL自定义函数标签
- jstl自定义函数
- 自定义JSTL函数标签
- jstl自定义函数
- jstl自定义函数
- jstl自定义函数
- JSTL 自定义Function函数标签
- 学会了这些!你就是天下间的美容高手
- 《拆掉思维里的墙》 阅读笔记
- MyISAM
- 数论概论笔记 第7章 因数分解与算数基本定理
- 使用 Filter 过滤器 处理中文 乱码问题
- jstl自定义函数
- JS控制图片显示的大小(图片等比例缩放)
- YII Framework学习教程-YII的Model-数据库操作4-翻译
- C Primer Plus 13章编程练习7问题
- Android学习笔记---20_采用ContentProvider对外共享数据, UriMatcher类使用介绍 ,ContentUris类使用介绍,使用ContentResolver操作Conte
- 发送邮件带word附件的.doc
- 提高PHP编程效率
- 简单web安全框架
- 又见 “快速排序”