Click Exit to destroy the session and return to the home page.
1. Add a link to exit in menu.jsp
<li id= "Headerregister" class= "Headerregister" style= "Display:list-item;" ><a href= "${pagecontext.request.contextpath}/user_quit" > Exit </a>|</li>
2, add the method in Useraction.java quit
/** * Exit * @return */public String Quit () {//Destroy Sessionservletactioncontext.getrequest (). GetSession (). invalidate (); return "Quit";}
3, in the Struts.xml configuration
<!--user Action-- <action name= "user_*" class= "useraction" method= "{1}" > <result name= " Registpage ">/WEB-INF/jsp/regist.jsp</result> <result name=" Input ">/web-inf/jsp/regist.jsp </result> <result name= "msg" >/WEB-INF/jsp/msg.jsp</result> <result name= "LoginPage" >/WEB-INF/jsp/login.jsp</result> <result name= "Login" >/WEB-INF/jsp/login.jsp</result> <result name= "loginsuccess" type= "redirect" >index</result> <result name= "quit" type= " Redirect ">index</result> </action>
10. User module: Log out