jsp登录页面中清除acegi的登录缓存信息
我的系统使用acegi登录认证,并且配置用户缓存
<!-- 缓存器,为userCacheBackend提供缓存管理。 -->
<bean id="cacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" />
<!-- EhCache一般用途如下:Hibernate缓存,DAO缓存,安全性凭证缓存(Acegi),Web缓存,应用持久化和分布式缓存。 -->
<bean id="userCacheBackend"
class="org.springframework.cache.ehcache.EhCacheFactoryBean">
<property name="cacheManager">
<ref local="cacheManager" />
</property>
<property name="cacheName">
<value>userCache</value>
</property>
</bean>
<!-- 用户缓存器,为daoAuthenticationProvider认证器提供缓存管理。 -->
<bean id="userCache"
class="org.springframework.security.providers.dao.cache.EhCacheBasedUserCache">
<property name="cache">
<ref local="userCacheBackend" />
</property>
</bean>
<!-- dao层认证,通过userDetailService获得用户信息 -->
<bean id="daoAuthenticationProvider"
class="org.springframework.security.providers.dao.DaoAuthenticationProvider">
<property name="userDetailsService">
<ref local="jdbcDaoImpl" />
</property>
<property name="userCache">
<ref local="userCache" />
</property>
</bean>
当用户成功登录后,登录信息被缓存在userCache,减少数据库的读取,如果想要清除缓存中数据,可以用以下方法:
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext());
//用户登录信息存在cache中,因此需要清除cache
CacheManager mange=(CacheManager)wac.getBean("cacheManager");
if (mange.cacheExists("
相关文档:
在我们装好MyEclipse时,有时双击打开jsp页面,
会提示错误,无法显示页面.
因此要将jsp的默认打开方式改成代码试图:
办法:在菜单栏的
1.window—->perferences—–>General——->editors——>file associations
2.选择jsp——->选择相应的editor 为def ......
<%@ page contentType="text/html; charset=gbk" language="java" import="java.io.*" buffer="64kb" %>
<%
String path_in = "";
String content = "";
path_in = request.getRealPath("/")+"admin"+File.separator+ ......
<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.io.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w ......
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Author" content="Jiang Hongbin">
<title>日期选择 - BY ziyue</title>
<script language="JavaScript" type="text/JavaScript">
// 日期选择
var months = new Array ......