访问struts2出了问题
正确的路径是:http://localhost:8080/ldfw/hotnewsAction!homePage.dhtml
我不小心写错了:http://localhost:8080/ldfw/hotnewsActon!homePage.dhtml
就是将:hotnewsAction写错了hotnewsActon 少写了一个i.
于是出现如下页面:
Struts Problem Report
Struts has detected an unhandled exception:
Messages: There is no Action mapped for namespace / and action name hotnewsActon.
--------------------------------------------
Stacktraces
There is no Action mapped for namespace / and action name hotnewsActon. - [unknown location]
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
java.lang.Thread.run(Thread.java:595)
--------------------------------------------
You are seeing this page because development mode is enabled. Development mode, or devMode, enables extra debugging behaviors and reports to assist developers. To disable this mode, set:
struts.devMode=false
in your WEB-INF/classes/struts.properties file.
于是想到一个问题,如果一个无聊的用户 也像我这样子 弄,故意破坏,那也会出现这个页面,这个对用户是无法接受的
我知道如404,500可以在web.xml中做处理。
但是现在我根本就不知道这个是个什么错误!
求高手,大侠!帮忙
------解决方案--------------------可以通过过滤器把错误页面转到指定页面
------解决方案--------------------如果不是你需要的那个页面 你直接跳转到一个共有的页面。
------解决方案--------------------在struts.xml里的actioon里配置input页面。出错了转向自己配置的页面。
------解决方案--------------------web.xml 配置404 500 400 然后其他错误统一转到一个页面, <您的行为不规范,请....> 然后再自动跳转首页.
------解决方案--------------------写配置文件的时候还是仔细点好,避免很多麻烦
------解决方案--------------------web.xml有配置异常的信息,
XML code
<error-page>
<error-code>404</error-code>
<location>/error/error.jsp</location>
</error-page>
------解决方案--------------------