http - ERR_TOO_MANY_REDIRECTS 错误你

标签 http struts2 glassfish redirect

事实:

我在浏览器 http://localhost:8080/myapp 上请求根应用程序,我的浏览器抛出此错误:错误 310 (net::ERR_TOO_MANY_REDIRECTS): 许多重定向.

环境:

我正在使用 Java 6、Glassfish 2.1、Struts2、Spring 和 Hibernate。

检查:

然后我查看 web.xml,在欢迎列表文件中我有这个:

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

那么,让我们检查一下 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>
...

然后我们可以转到struts.xml,我们可以看到这个 block :

...
<package name="portal-action" extends="portal-base" namespace="/portal">
    <action name="home" method="home" class="beginAction">
        <result type="tiles">begin.home</result>
    </action>
...

让我们检查 beginAction 类:

...
public String home(){
    return SUCCESS;
}
...

我们可以检查tiles.xml:

...
<definition name="begin.welcome" extends=".baseHome">
    <put-attribute name="working.region" value="/jsp/common/welcome.jsp" />
</definition>
...

最后我们可以查看整个 welcome.jsp 文件,它只包含:

<%@ taglib prefix="s" uri="/struts-tags"%>
<br />

就是这样!

你对这个问题有什么想法吗?

最佳答案

很明显,您的应用似乎陷入了重定向循环。查看您的配置,我不知道可能是什么问题。我会尝试打开网络监视器,如 Fiddler ,或 Chrome 开发人员工具中的“网络”选项卡,并查看响应 header 以了解它试图将您重定向到的位置......这可能有助于揭示这里出了什么问题。

关于http - ERR_TOO_MANY_REDIRECTS 错误你,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7550635/

相关文章:

http - 如何获取HTTP 404响应的响应内容

c# - ASP.NET MVC 网络 API : application/xml PUT request body is null on server side

java - struts.config 到 struts2 的转换

java - 无法使用 Hibernate 5 部署应用程序

glassfish - 通过 JMX 将 JConsole 连接到远程 glassfish 4.1/4.1.1

jsf - Glassfish 3 + 耳朵 + logback.xml

javascript - 错误 : request entity too large

http - Qt 使用 QNetworkAccessManager 登录 steam

java - Struts2 - 嵌套 <s :property> in a custom tag

jquery - Struts 2 jQuery Subscribe 被多次调用