<sec:authorize ifAnyGranted="<%=dRoles%>">
<meta http-equiv="REFRESH" content="0;url=public/First.jsp">
</sec:authorize>
<sec:authorize ifAnyGranted="<%=aRoles%>">
<meta http-equiv="REFRESH" content="0;url=public/Second.jsp">
</sec:authorize>
<sec:authorize ifAnyGranted="<%=bRoles%>">
<meta http-equiv="REFRESH" content="0;url=public/Third.jsp">
</sec:authorize>
我在用弹簧保安。登录成功后,(default-target-url="/Startup.jsp).加载了Startup.jsp --我的Startup.jsp中有上面的代码。我使用的是spring安全标签。考虑到用户可以访问上面所有的3个jsps。的问题是,在IE7中,First.jsp是加载的,但在其他浏览器中,Third.jsp被加载了。我如何在两个浏览器中显示相同的jsp?
谢谢!
发布于 2012-09-20 10:38:00
我猜您所处的情况是用户在dRoles
中有角色,在bRoles
中也有角色,因此您的代码会向浏览器发送两种不同的元刷新。
首先,不要使用元刷新,而是使用真正的重定向或转发(这不应该在JSP中完成,而应该在控制器、过滤器或servlet中完成)。
如果您真的想继续使用JSP解决方案,那么我想这样的方法应该会奏效:
<c:set var="refreshSent" value="${false}"/>
<sec:authorize ifAnyGranted="<%=dRoles%>">
<meta http-equiv="REFRESH" content="0;url=public/First.jsp">
<c:set var="refreshSent" value="${true}"/>
</sec:authorize>
<sec:authorize ifAnyGranted="<%=aRoles%>">
<c:if test="${!refreshSent}">
<meta http-equiv="REFRESH" content="0;url=public/Second.jsp">
<c:set var="refreshSent" value="${true}"/>
</c:if>
</sec:authorize>
<sec:authorize ifAnyGranted="<%=bRoles%>">
<c:if test="${!refreshSent}">
<meta http-equiv="REFRESH" content="0;url=public/Third.jsp">
<c:set var="refreshSent" value="${true}"/>
</c:if>
</sec:authorize>
https://stackoverflow.com/questions/12510756
复制相似问题