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);可以相对路径也可以绝对路径。

 

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

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

posted @ 2013-01-23 22:46  眼镜_ing  阅读(5716)  评论(0编辑  收藏  举报
加载中……