2012-12-07 11 views
5

Czy można używać Tiles2 z Struts 1?Jak korzystać z Tiles2 ze Struts 1

I już po instrukcje dostępne w przewodniku migracji http://tiles.apache.org/migration/index.html

Ale gdy próbuję dostęp do moich działań, otrzymuję ten błąd:

org.apache.tiles.template.NoSuchAttributeException: Attribute 'body' not found. 

mam w struts-config.xml:

<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" 
    maxFileSize="10M" tempDir="/tmp" /> 

<plug-in className="org.apache.struts.tiles.TilesPlugin"> 
    <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" /> 
</plug-in> 

i płytek-defs.xml

<definition name="mainTemplate" template="/common/templates/mainTemplate.jsp" /> 
    <definition name="index" extends="mainTemplate"> 
     <put-attribute name="body" type="string" value="/views/index/index.jsp" /> 
    </definition> 

Odpowiedz

1

Wprowadź następujące zmiany w swoim struts-config.xml

<controller processorClass=”org.apache.struts.tiles2.TilesRequestProcessor”/> 
<plug-in className=”org.apache.struts.tiles2.TilesPlugin” > 

Znajdź źródeł wtyczki Tiles2 here.

-2

Tak, można go używać z rozpórkami 1. Check their site.

atrybuty

Put w was rozmieszcza plik dla mainTemplate odczuwalna:

<definition name="mainTemplate" path="/common/templates/mainTemplate.jsp"> 
    <put name="title" value="Tiles Example" /> 
    <put name="header" value="/header.jsp" /> 
    <put name="menu" value="/menu.jsp" /> 
    <put name="body" value="/body.jsp" /> 
    <put name="footer" value="/footer.jsp" /> 
</definition> 

Jeśli to nie poskutkuje, to spróbuj zmienić struts-config.xml jak:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE struts-config PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" 
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd"> 

<struts-config> 

    <action-mappings> 

     <action 
      path="/User" 
      type="org.apache.struts.actions.ForwardAction" 
      parameter="/pages/user/user-form.jsp"/> 

    </action-mappings> 

    <plug-in className="org.apache.struts.tiles.TilesPlugin" > 
     <set-property property="definitions-config" 
     value="/WEB-INF/tiles-defs.xml"/> 
    </plug-in> 

</struts-config> 
+0

jest to rozwiązanie do płytek 1. muszę użyj płytek 2 –

Powiązane problemy