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("
相关文档:
有两种传参方式
一、get方式:
这种方式将参数写在url中,举例来说,如果目标传参页面是target.jsp,那么在url里可以这么写:
http://..../target.jsp? <Param1> = <value1> & <Param2> = <value2> &...
&n ......
为了减轻服务器压力,将原来的文章管理系统由JSP文件的从数据库中取数据显示改为由jsp生成静态html文件后直接访问html文件。首先应创建一个模板文件,文件名和文件后缀可以随意,但我一般常用的还是 *.template ,因此,这里就以 template.template 为例( 将模板文件放入 /WEB-INF/templates/ 文件夹下 ):下面是一个简单的 ......
一、JSP页面显示乱码
二、表单提交中文时出现乱码
三、数据库连接
大家在JSP的开发过程中,经常出现中文乱码的问题,可能一至困扰着您,我现在把我在JSP开发中遇到
的中文乱码的问题及解决办法写出来供大家参考。
一、JSP页面显示乱码
下面的显示页面(display.jsp)就出现乱码:
<html>
<head>
<tit ......
建立条件首先一定要确定自己的mysql,tomcat,eclipse连接是正确的。
index.jsp很简单,就一个跳转。
<%
response.sendRedirect("lg.jsp");
%>
lg.jsp 实现登录框架
<%@ page contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>
login
</title>
</hea ......