关于struts的tiles问题

smallsweetsheep 2005-12-01 10:17:36
报了这个错:
java.lang.IllegalArgumentException: Path zoneListPage does not start with a "/" character
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:320)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


不知道为什么,急等江湖救急啊~,我的相关代码如下:

1、在fw-tiles-defn.xml中如下定义:
……
<definition name="fw" path="/webclient/common/jsp/MainLayout.jsp">
<put name="Tree" value=".tree.controller" />
<put name="Tab" value=".tab.controller" />
<put name="MainPage" value="" />
</definition>

<definition name=".tree.controller"
path="/webclient/common/jsp/NavigationComponent.jsp" controllerClass="com.adventnet.nms.webclient.common.TreeAction" />

<definition name=".tab.controller"
path="/webclient/common/jsp/TabComponent.jsp"
controllerClass="com.adventnet.nms.webclient.common.TabAction" />

<definition name=".component.pagetraversal"
path="/webclient/common/jsp/PageNavigation.jsp"
controllerClass="com.adventnet.nms.webclient.common.PageTraversalController">
</definition>

<definition name="zoneListPage" extends="fw">
<put name="MainPage" value="zoneListDef"/>
</definition>

<definition name="zoneListDef" path="/webclient/common/jsp/listViewLayout.jsp">
<put name="PageIncludes" value="/webclient/ffcs/jsp/configuration/fw/fwCfg/fwOption/listViewIncludes.jsp"/>
<put name="HeaderIncludes" value="/webclient/ffcs/jsp/configuration/fw/fwCfg/fwOption/listHeaderInclude.jsp"/>
<put name="PageTraversal" value=".component.pagetraversal"/>
<put name="StatusMessage" value="/webclient/ffcs/jsp/configuration/fw/fwCfg/fwOption/listViewStatus.jsp"/>
<put name="ListView" value="/webclient/ffcs/jsp/configuration/fw/fwCfg/fwOption/zoneList.jsp"/>
</definition>
……

2、在fw-struts-config.xml中这样配置:

……
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/webclient/ffcs/conf/configuration/fw/fw-tiles-defn.xml" />
<set-property property="moduleAware" value="true" />
<set-property property="definitions-parser-validate" value="true" />
</plug-in>
……

3、在fw-struts-config.xml中相关映射部分:
……
<action path="/webclient/jsp/configuration/fw/zoneList"
type="cn.configuration.fw.ZoneAction"
name="zoneForm"
scope="request">
<forward name="zoneList" path="zoneListPage" contextRelative="true"/>
</action>
……

4、调用时候用“http://……/webclient/jsp/configuration/fw/zoneList.do"
然后就报了如上的错,是不是在哪儿的配置没有配好?貌似没有识别到tiles的有关内容。
...全文
1363 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
smallsweetsheep 2005-12-02
  • 打赏
  • 举报
回复
TO mxlmwl:
我昨天按你说的试了一下,可是问题还存在,我想问题应该是存在module定义方面,因为我基于的那个平台并没象你说的那样定义,我完全按照那个平台已有的模块设置,就出了这个错。我再试着改改,问题解决了就散分啊,俺抱拳谢过大家伙了~^_^

smallsweetsheep 2005-12-01
  • 打赏
  • 举报
回复
这是个嵌套的tiles definition,“zoneListDef”我在接下去定义了的:
<definition name="zoneListDef" path="/webclient/common/jsp/listViewLayout.jsp">
<put name="PageIncludes" value="/webclient/ffcs/jsp/configuration/fw/fwCfg/fwOption/listViewIncludes.jsp"/>
……
</definition>

zoneListPage 不能以/开头吧,否则它就不是去fw-tiles-defn.xml里头找相关配置了,是这样么?
soso119 2005-12-01
  • 打赏
  • 举报
回复
<put name="MainPage" value="zoneListDef"/>
中的value属性改成你实际的jsp文件名.
楼上的正解.
nighthawk 2005-12-01
  • 打赏
  • 举报
回复
问题很明显。
<definition name="zoneListPage" extends="fw">
<put name="MainPage" value="zoneListDef"/>
</definition>
注意以上我贴出的地方,value="zoneListDef"这里应该是你给出文件的路径。
比如/webclient/ffcs/jsp/xxxxxxx.jsp 而你这里只是zoneListDef。

Path zoneListPage does not start with a "/" character 指zoneListPage 没有以/开头。
说的就是这。楼主好好检查吧。good luck
smallsweetsheep 2005-12-01
  • 打赏
  • 举报
回复
初学tiles,很多地方不明白,我的理解是,在:<forward name="zoneList" path="zoneListPage" contextRelative="true"/>的时候,应该转到fw-tiles-defn.xml中寻找<definition name="zoneListPage"……的内容,然后根据模板定义,跳到之后的path="……"页面。
可是它报那个错,是不是意味着它就没到fw-tiles-defn.xml中?
xpzheng 2005-12-01
  • 打赏
  • 举报
回复
初学者,学习!
jxdn_yang 2005-12-01
  • 打赏
  • 举报
回复
Path zoneListPage does not start with a "/" character
页面的问题吧
抽空来接份^_^
mxlmwl 2005-12-01
  • 打赏
  • 举报
回复
我不是和你说了嘛,要把plugin-in同时定义在structs-config.xml中和你的模块化的fw-struts-config.xml中,两个地方都要有才行。只有struct-config.xml一个文件里有是没有用的。
smallsweetsheep 2005-12-01
  • 打赏
  • 举报
回复
我好像知道一点问题了,貌似是我module定义的问题,但目前仅是猜测,我吧fw-tiles-defn.xml改为tiles-defn.xml,好像那个“java.lang.IllegalArgumentException: Path zoneListPage does not start with a "/" character”的错误就没了。

另<set-property property="moduleAware" value="true" />什么意思?我把这个true改为了false。猜测:模块无关?
smallsweetsheep 2005-12-01
  • 打赏
  • 举报
回复
发现控制台还报了如下信息:
2005-12-1 15:10:01 org.apache.struts.tiles.TilesRequestProcessor initDefinitionsMapping
信息: Tiles definition factory found for request processor ''.
……
2005-12-1 15:16:52 org.apache.struts.tiles.TilesPlugin init
信息: Tiles definition factory loaded for module ''.
smallsweetsheep 2005-12-01
  • 打赏
  • 举报
回复
对,我正怀疑它没找到我的tiles的xml文件,可是我的配置错在哪呢?
“<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/webclient/ffcs/conf/configuration/fw/fw-tiles-defn.xml" />
<set-property property="moduleAware" value="true" />
<set-property property="definitions-parser-validate" value="true" />
</plug-in>
”?

to yxhzj:改成path=".zoneListPage",还是报那样的错。
mxlmwl 2005-12-01
  • 打赏
  • 举报
回复
如果你用structs模块化开发的话,仍然使用 tiles,需要在每个模块的structs-config.xml中也加上tiles的plugin,即也需要加
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/webclient/ffcs/conf/configuration/fw/fw-tiles-defn.xml" />
<set-property property="moduleAware" value="true" />
<set-property property="definitions-parser-validate" value="true" />
</plug-in>
这种东西。
我没有看过structs的源代码(比较懒),呵呵,反正加上后就能用了,具体原因我也不知道,别问我:)。

不光是这个,包括资源文件,控制器等,都是一样的道理。
fashchina 2005-12-01
  • 打赏
  • 举报
回复
<forward name="zoneList" path="zoneListPage" contextRelative="true"/>

--->

<forward name="zoneList" path=".zoneListPage" contextRelative="true"/>
nighthawk 2005-12-01
  • 打赏
  • 举报
回复
似乎那个错是struts-config.xml那里报出来的
<action path="/webclient/jsp/configuration/fw/zoneList"
type="cn.configuration.fw.ZoneAction"
name="zoneForm"
scope="request">
<forward name="zoneList" path="zoneListPage" contextRelative="true"/>
</action>
应该是path="zoneListPage"这里的问题。难道说:没找到你的tiles文件?我有点怀疑了。呵呵
smallsweetsheep 2005-12-01
  • 打赏
  • 举报
回复
谢谢nighthawk!
但是问题似乎不在这,我按照你说的改了,问题没有任何变化,因为它报的错是在zoneListPage这层的吧,我实在找不到错了,郁闷啊~
nighthawk 2005-12-01
  • 打赏
  • 举报
回复
我帮你查了一下文档。关于put标签的。请看
type :The type of the value. Can be: string, page, template or definition. By default, no type is associated to a value. If a type is associated, it will be used as a hint to process the value when the attribute will be used in the inserted tiles. A type of "string" indicates that the value should be inserted directly into the content of the page. A type of "page" or "template" indicates that the value is the URL of a page that should be included. A type of "definition" indicates that the value is the name of another Tiles definition that should be included in the page.
按照上面所说的。这么改一下试试
<put name="MainPage" value="zoneListDef" type="definition"/>

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧