Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Tiles2 with Struts 1

Is it possible to use Tiles2 with Struts 1?

I've followed the instruction available at the migration guide http://tiles.apache.org/migration/index.html

But when I try to access my actions, I get this error:

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

I have in 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>

And tiles-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>
like image 776
Daniel Cukier Avatar asked Nov 27 '22 10:11

Daniel Cukier


1 Answers

Make the following changes in your struts-config.xml

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

Find the sources for the Tiles2 plugin here.

like image 70
sumit sharma Avatar answered Nov 28 '22 23:11

sumit sharma