2011-03-17 5 views
1

은 로컬 개발을위한 가상 디렉터리가있는 스트럿츠 타일을 구성하는 데 심각한 문제가 있습니다. 내 tiles-def.xml이 내 귀에 배포되어 있습니다. 그리고 난 가상 디렉토리 매핑을 가지고 있는데, 위대한 작품이지만 타일이 아니기 때문에 jsp를 타일에 넣고 싶다.스트럿츠 타일이있는 가상 디렉터리

이 가능합니까? 아무도 경험이 있습니까?

감사

답변

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이나 스트럿츠의 액션 클래스의 디렉토리 구조에 액세스 할 경우, 다음과 같이 타일 결과에 전달 될 수있다 : 당신은 다음 와일드 카드뿐만 아니라을 받아 타일을 설정

//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> 
관련 문제