struts2 拦截器

来源:百度知道 编辑:UC知道 时间:2024/06/18 17:03:31
我的网页要求用户登录后才能进入页面,配置好拦截器,但还是可以不登录进入页面,什么原因啊?

struts.xml部分:
<package name="default" extends ="struts-default">

<interceptors>
<interceptor name="checkLogin" class="interceptor.CheckLogin"/>
<interceptor-stack name="securityStack">
<interceptor-ref name="checkLogin" />
<interceptor-ref name="validationWorkflowStack" />

</interceptor-stack>
</interceptors>

<global-results>
<result name="login">err.jsp</result>
</global-results>

<action name="loggin" class="action.LogginAction">
<interceptor-ref name="validationWorkflowStack" />
<result name="success">index.jsp</re

struts2拦截器只对action拦截,而不拦截jsp.
对jsp进行权限可以有很多方法,比如:
1.在每个Jsp中用if做判断看session中是否有值*(不推荐,太繁琐)
2.把所有Jsp放到web-inf目录下。客户端不能直接访问它下面的文件。
3.配置过滤器过滤所有jsp页面。