0

I am using Tiles with Struts2. In struts.xml I need to define <result-types> for every package. How can I make it global so all packages show type as tiles like <result type="tiles"></result>

 <package name="student" namespace="/student" extends="struts-default">

        <result-types>
            <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/>
        </result-types>
</package>
Pirzada
  • 4,685
  • 18
  • 60
  • 113

1 Answers1

1

You'd put your actions into a package extending "tiles-default" instead of "struts-default". The "tiles-default" package already defines a "tiles" result type.

Alternatively, you could create a parent package that extends "tiles-default" and use that as your parent package for all your app's packages.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • 2
    Or he could define a stack that extends anything, or a new one from scratch so long has he defines result-types with a result-type tag naming the tiles result, with a default attribute and a value of true (he has everything currently in his current xml except 'default ="true"')... as explained here: http://struts.apache.org/2.1.6/docs/result-configuration.html – Quaternion Oct 02 '12 at 22:37
  • @dave-newton, I have added your solution in the question at bottom. I hope that's what you wanted me to do. right? – Pirzada Oct 04 '12 at 03:40
  • @Rashid No, there already *is* a "tiles-default" package, provided by the tiles plugin. You're doing what Quaternion suggests, but naming it the same as a package provided already. – Dave Newton Oct 04 '12 at 03:46