开发者

Virtual Directory with struts-tiles

is have serious problems in configuring struts-tiles with virtual-directories for local developement. I have got my tiles-def.xml deployed in my ear. And i have got virtual-directory mapping, which works great, but not with tiles, because i want to include the jsp in my tiles-def.

is this possible? Does anybody have an experience?

开发者_开发问答Thanks


I would probably try using wildcards with your struts tiles results.

http://struts.apache.org/2.2.3/docs/wildcard-mappings.html

You may also need to include some configuration settings in your struts.xml:

<constant name="struts.enable.SlashesInActionNames" value="true"/>
<constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>
<constant name="struts.patternMatcher" value="regex" />

If you have access to the directory structure in the url or in the struts action class, it can be passed to the tiles results as follows:

//passing the value in with the action call
<action name="hello/{myDirectory}">
    <result type="tiles">/Hello.{1}.tiles</result>
</action>

//passing the value from a field within the action
<action name="hello">
    <result type="tiles">/Hello.${myDirectory}.tiles</result>
</action>   

You then set up the tiles to accept wildcards as well

http://tiles.apache.org/framework/tutorial/advanced/wildcard.html

<definition name="hello.*.tiles" template="/layout.jsp">
    <put-attribute name="body" value="/{1}/hello.jsp"/>
</definition>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜