2012-09-20 40 views
0
<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> 

我使用弹簧安全。 登录成功后,加载了Startup.jsp(default-target-url =“/ Startup.jsp)我在Startup.jsp中有上面的代码,我使用的是spring安全标签,考虑到用户可以访问所有上述3层的JSP。问题是,在IE7,First.jsp被加载,但在其他浏览器Third.jsp加载。 如何显示在这两种浏览器相同的JSP?在不同的浏览器中加载相同的jsp?

谢谢!

+0

'含量= “0; URL =公/ Second.jsp”>'更改是0至1000 (或者一个足够长的数字)拉起渲染页面的源代码,使其在问题浏览器中呈现。 –

回答

0

我猜你正处于用户角色为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> 
+0

@Nizet,非常感谢您的解决方案。有效。 – user1016403

相关问题