java.lang.IllegalArgumentException: Path index does not start with a "/" character


java.lang.IllegalArgumentException: Path index does not start with a "/" character
最近用struts的Tiles框架出现以下问题:
java.lang.IllegalArgumentException: Path index does not start with a "/" character 
查了好久才发现错误。

后来发现是 struts-config.xml中少配置了<controller>这一项,

配置了<controller>后,就一切正常了

<controller>
<set-property property="processorClass" value="org.apache.struts.tiles.TilesRequestProcessor"/>
</controller>

或者是

<controller>
<set-property property="inputForward" value="true"/>
</controller>

同时发现出现这样的错误还有以下原因

1. struts-config.xml文件中<action-mappings /> 的

<action …… input="/xxx.jsp" ……   path="/XXX" ></action>

2.  问题出在使用getRequestDispatcher上面。

使用ServletContext.getRequestDispatcher(destPage);时destPage必须以相对路径“/"出现。

而HttpServletRequest request.getRequestDispatcher(destPage);可以相对路径也可以绝对路径。

 

总之,希望大家今后在写的时候要仔细。

 更多错误,请参阅 个人工作站:在这里网-前端技术博客


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM