最好是rbac的,acl的也可以,一直在看别人讨论权限,自己没有亲自动手写过,也不知道该怎么写.能直接导入myeclipse,最好是mysql,tomcat这些最常用的环境下面,感激不尽了!我邮箱[email protected]
解决方案 »
- Struts1报错,no type for /user/login 紧急求助
- 从JSP传数组给Servlet
- ireport 套打 连起来打的时候跟分开打效果不一样
- 急!!!在线等!webwork + tomcat (安装版的) 正常用的时候都没有问题,可是这次培训,并发的用户数在40个左右,出问题了
- 向数据库插入数据出错
- 替代传统C/S和B/S技术的下一代客户/服务器编程技术
- 这个问题比较困难,有待高人指点
- 100分求jive的原代码(没有30天licence限制的),jdon版的也可以.
- 在TOMCAT里面,开发出来的JAVABEAN放在什么地方呢?
- 页面跟Applet之间的数据传输问题(各位多多帮助)
- CSS表格边框样式
- frameset自动刷新问题
[email protected]
private FilterConfig filterConfig = null;
private String encoding = null; //默认构造函数
public FilterValet() {
} //初始化过滤器
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
}
//执行过滤操作
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) throws
IOException, ServletException {
HttpServletRequest servletRequest = (HttpServletRequest) request; HttpServletResponse servletResponse = (HttpServletResponse) response; HttpSession session = servletRequest.getSession();
String user=(String)servletRequest.getSession().getAttribute("purviews"); //获取purviews权限内空
// String user=(String)session.getAttribute("user");
System.out.println("NEW_seesion_purviews="+user);
// String url = servletRequest.getRequestURI();
//System.out.println("url="+url);
// String isLog = (String) servletRequest.getSession().getAttribute("isLog");
// System.out.println("isLog = " + isLog);
if (user == null) { //根据purviews权限内空设定内容(自定义), servletResponse.sendRedirect("/admin/login.jsp");//如果purviews有无内容则进入登陆页 }else { filterChain.doFilter(request, response); ;//如果purviews有内容则放行,进入下一步操作 }
} public void destroy() {
filterConfig = null;
encoding = null;
}
}web.xml配置:
?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
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-app_2_4.xsd">
<filter>
<filter-name>FilterValet</filter-name>
<filter-class>validateservlet.FilterValet</filter-class>
</filter>
<filter-mapping>
<filter-name>FilterValet</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>