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)
就这样!
你对这个问题有所了解吗?