Struts2 带struts tiles的虚拟目录

Struts2 带struts tiles的虚拟目录,struts2,tiles,Struts2,Tiles,is在为本地开发配置带有虚拟目录的struts Tile时存在严重问题。我已将tiles-def.xml部署到耳朵中。我已经得到了虚拟目录映射,它非常有效,但不适用于tiles,因为我想在tiles def中包含jsp 这可能吗?有人有经验吗 谢谢我可能会尝试在您的struts tiles结果中使用通配符 您可能还需要在struts.xml中包含一些配置设置: <constant name="struts.enable.SlashesInActionNames" value="true"

is在为本地开发配置带有虚拟目录的struts Tile时存在严重问题。我已将tiles-def.xml部署到耳朵中。我已经得到了虚拟目录映射,它非常有效,但不适用于tiles,因为我想在tiles def中包含jsp

这可能吗?有人有经验吗


谢谢

我可能会尝试在您的struts tiles结果中使用通配符

您可能还需要在struts.xml中包含一些配置设置:

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

如果您可以访问url或struts action类中的目录结构,则可以将其传递给tiles结果,如下所示:

//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>   
//将值与操作调用一起传入


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