更改java版本后“路径login.page不以“/”字符开头的消息异常
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2342325/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Path login.page does not start with a "/" character" message exception after changing java version
提问by Anca Z
I have a web application which worked with the following: Tomcat 5.0 Struts 1.0 Java 1.5
我有一个使用以下内容的 Web 应用程序:Tomcat 5.0 Struts 1.0 Java 1.5
I have to switch to Java 1.6.When I tried to do that, i received the following stack of exception in my browser:
我必须切换到 Java 1.6。当我尝试这样做时,我在浏览器中收到以下异常堆栈:
javax.servlet.ServletException: Path login.page does not start with a "/" character
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:72)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:712)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:682)
org.apache.jsp.index_jsp._jspService(index_jsp.java:45)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
root cause
根本原因
java.lang.IllegalArgumentException: Path login.page does not start with a "/" character
org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:107)
org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:72)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:712)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:682)
org.apache.jsp.index_jsp._jspService(index_jsp.java:45)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
回答by polygenelubricants
It looks like a request is made to "login.page"
, which as the exception indicates, does not start with a "/"
. Try requesting for "/login.page"
instead.
看起来像是对 发出的请求"login.page"
,正如异常所指示的那样,它不以 开头"/"
。尝试请求"/login.page"
代替。
Most servlet libraries require that pathnames begins with a "/"
. For example: javax.servlet.ServletContext#getRequestDispatcher:
大多数 servlet 库要求路径名以"/"
. 例如:javax.servlet.ServletContext#getRequestDispatcher:
The pathname must begin with a
"/"
and is interpreted as relative to the current context root. UsegetContext
to obtain aRequestDispatcher
for resources in foreign contexts.
路径名必须以 a 开头,
"/"
并被解释为相对于当前上下文根。使用getContext
获得RequestDispatcher
的国外环境资源。
回答by prathapd
add the tile request processor class and remove the conten type attribute from controller tag
添加 tile 请求处理器类并从控制器标签中删除内容类型属性
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" />
<message-resources parameter="EMSMessageResources" null="false" ></message-resources>
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/ems-tiles-defs.xml" />
<set-property property="moduleAware" value="true" />
</plug-in>
回答by Mordrekai
Check this page.
检查此页面。
http://wiki.apache.org/struts/StrutsUpgradeNotes12to13
http://wiki.apache.org/struts/StrutsUpgradeNotes12to13
Obviously you're using stuts tiles. If you're using Struts 1.3, you should add this to your web.xml file:
显然你正在使用 stuts 瓷砖。如果您使用的是 Struts 1.3,您应该将其添加到您的 web.xml 文件中:
<init-param>
<param-name>chainConfig</param-name>
<param-value>org/apache/struts/tiles/chain-config.xml</param-value>
</init-param>
回答by Ajay
Solved
解决了
Whenever new Jsp file is added new entry goes in respective
每当添加新的 Jsp 文件时,相应的新条目就会进入
"struts-config_* .xml" and "tiles-defs_* .xml" files.
“ struts-config_* .xml”和“ tiles-defs_* .xml”文件。