JAVA web页面刷新和session问题
框架是ssi 在登录后到了某个界面,如果按下刷新的话会提示是否要重新发送信息
可是在csdn这种网页 登陆后刷新某页也没有这种提示啊
另外 如果过了一段时间 再刷新会直接报500错误
The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
cn.xiaozhi.service.LoginService.loginVali(LoginService.java:34)
cn.xiaozhi.action.LoginProcess.execute(LoginProcess.java:46)
sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)
。。。。。
web.xml为:
<?xml version="1.0" encoding="UTF-8" ?>
<web-app id="WebApp_9" 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">
<display-name>Struts Blank</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener </listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
能告诉我这个是怎么个情况?session超时的话 应该怎么修改
------解决方案--------------------实例功能:当用户登陆后,session超时后则返回到登陆页面重新登陆。
为了更好的实现此功能我们先将session失效时间设置的小点,这里我们设置成2分钟
修改web.xml?
<session-config>
?<session-timeout>2</session-timeout>
</session-config>
在这里要注意了,所有经过拦截器的action类都必须实现Action接口或者继承自ActionSupport父类,如果不继承将会报500错误
Struts2自定义拦截器实例—登陆权限验证
实现自定义拦截器类
package org.hongfei.interceptor;
import java.util.Map;
import org.hongfei.entity.User;
import org.hongfei.web.action.AdminLoginAction;
import org.hongfei.web.action.UserLoginAction;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
public class SessionInterceptor extend