ERR_TOO_MANY_REDIRECTS错误你

Isr*_*ael 5 redirect struts2 http glassfish

事实:

我在浏览器上请求root应用程序,我的浏览http://localhost:8080/myapp器抛出了这个错误:Error 310 (net::ERR_TOO_MANY_REDIRECTS): many redirects.

环境:

我正在使用Java 6,Glassfish 2.1,Struts2,Spring和Hibernate.

校验:

然后我查看web.xml和welcome-list-files我有这个:

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>
Run Code Online (Sandbox Code Playgroud)

所以,让我们检查index.jsp并有这个重定向:

...
<head>
<meta http-equiv="refresh" content="0;url=<%=request.getContextPath()%>/portal/home.do">
...
<link rel="shortcut icon" href="<%=request.getContextPath()%>/img/icono.png" />
</head>
...
Run Code Online (Sandbox Code Playgroud)

然后我们可以去struts.xml,我们可以看到这个块:

...
<package name="portal-action" extends="portal-base" namespace="/portal">
    <action name="home" method="home" class="beginAction">
        <result type="tiles">begin.home</result>
    </action>
...
Run Code Online (Sandbox Code Playgroud)

我们来检查beginAction课程:

...
public String home(){
    return SUCCESS;
}
...
Run Code Online (Sandbox Code Playgroud)

我们可以检查tiles.xml:

...
<definition name="begin.welcome" extends=".baseHome">
    <put-attribute name="working.region" value="/jsp/common/welcome.jsp" />
</definition>
...
Run Code Online (Sandbox Code Playgroud)

最后我们可以查看welcome.jsp仅包含以下内容的整个文件:

<%@ taglib prefix="s" uri="/struts-tags"%>
<br />
Run Code Online (Sandbox Code Playgroud)

就这样!

你对这个问题有所了解吗?

Jas*_*ltz 6

只是说明显而易见,看起来您的应用程序被捕获在重定向循环中.看看你的配置,我不知道问题是什么.我会尝试打开像Fiddler这样的网络监视器,或Chrome开发者工具中的"网络"选项卡,查看响应标题,看看它试图将你重定向到哪里......这可能有助于揭示这里出了什么问题.