2011-03-17 78 views
1

在配置用於本地開發的虛擬目錄的struts-tiles中存在嚴重問題。我已經將我的tiles-def.xml部署在我的耳邊。而且我有虛擬目錄映射,這很好用,但不能用於tile,因爲我想在我的tiles-def中包含jsp。帶struts-tiles的虛擬目錄

這是可能的嗎?有人有經驗嗎?

感謝

回答

0

我可能會嘗試使用通配符與支柱瓷磚的結果。

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

您可能還需要包括在你的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類,它可以傳遞給瓦片結果如下:

//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> 

然後設置了瓷磚接受通配符以及

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>