问题描述
struct-config.xml:---------------------------------------------------------------<action-mappings><actiontype="sample.action.TestAction"path="/welcome"scope="request"><forwardname="success"path=".customer.page"></forward></action></action-mappings><plug-inclassName="org.apache.struts.tiles.TilesPlugin"><set-propertyproperty="definitions-config"value="/WEB-INF/tiles-defs.xml"/><set-propertyproperty="moduleAware"value="true"/><set-propertyproperty="definitions-parser-validate"value="true"/></plug-in>tiles-defs.xml----------------------------------------------------------------<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEstruts-configPUBLIC"-//ApacheSoftwareFoundation//DTDStrutsConfiguration1.3//EN""../webapps/tiles1/WEB-INF/struts-tiles.dtd"><tiles-definitions><definitionname="site.mainLayout"path="/layouts/template.jsp"><putname="title"value="TilesBlankSite"/><putname="header"value="/layouts/header.jsp"/><putname="menu"value="/layouts/menu.jsp"/><putname="footer"value="/layouts/footer.jsp"/><putname="body"value="content"/></definition><definitionname=".customer.page"extends="site.mainLayout"><putname="body"value="/customer/a.jsp"/></definition></tiles-definitions>输入http://localhost:8088/tiles1/welcome.do为什么出错如下:javax.servlet.ServletException:java.lang.IllegalArgumentException:Path.customer.pagedoesnotstartwitha"/"characterorg.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:690)javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
解决方案
本帖最后由 guoxiaolong88 于 2010-12-08 11:50:44 编辑
解决方案二:
<definitionname=".customer.page"extends="site.mainLayout">不是这里出错吗?
解决方案三:
?引用1楼chouy的回复:
<definitionname=".customer.page"extends="site.mainLayout">不是这里出错吗?
解决方案四:
就是让forward去跳转tiles的definition的时候报错了!=".customer.page"是为了区别struct-config.xml里的/XXX所以用的。
解决方案五:
<forwardname="success"path="/.customer.page"></forward><!--path路径之前要加/-->