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

 

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

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

相关文章:

  • 2022-12-23
  • 2021-11-15
  • 2021-05-14
  • 2021-11-22
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-02
  • 2021-06-07
  • 2022-12-23
  • 2021-07-28
  • 2021-06-13
  • 2022-12-23
  • 2022-02-09
相关资源
相似解决方案