路小弟
2017-01-07 19:26
<action name="LoginAction" method="login" class="com.action.LoginAction">
<result name="success">/WEB-INF/page/manager.jsp</result>
<result name="error">/login.jsp</result>
</action>
还需要auth 这个action干嘛? 初学者请教大神
因为Manager.jsp页面不在WEB-INF目录下,浏览器输入URL是访问不到的,所以需要auth来跳转,也因此只需要对auth配置拦截器判断是否已经登录,登录了就放行执行auth这个ACTION的内容也就是跳转,没登陆就跳转到登录页面login.jsp
通过.../auth进入,首先执行拦截器,之前没登录过的,到login.jsp页面。有登陆过的到manager.jsp(因为action name="auth"没有写class,默认是ActionSupport类,直接到manager.jsp)
这个是首次登陆时验证的,然后会将信息放在Session中,拦截器通过Session判断是否登陆
Struts2拦截器浅析
37975 学习 · 121 问题
相似问题