I arrived at the same conclusion when trying to remove my tiles
configuration. I upgraded to tiles 3 in the process and wrote a custom
result handler (sorry a custom "unknown result handler"). It is invoked
when conventions isn't able to find an appropriate result.

 Here is a stack overflow Q & A which covers that process: "How to
Integrate Struts Conventions with Tiles such that the benefit of
conventions is maintained" http://stackoverflow.com/q/16116142/514065



On Thu, Jan 2, 2014 at 9:16 AM, Paul Benedict <pbened...@apache.org> wrote:

> Annotations usually help augment the class being annotated. I don't think
> annotating a Struts action with Tile definitions is very appropriate for
> this purpose. The purposes are just very different. XML seems more
> appropriate than annotations here.
>
>
>
>
> On Thu, Jan 2, 2014 at 10:02 AM, Christoph Nenning <
> christoph.nenn...@lex-com.net> wrote:
>
> > Dear List,
> >
> >
> > in our applications we often use the convention-plugin together with
> > tiles-plugin (tiles 2).
> >
> > convention-plugin has the advantage that it is not necessary to put an
> > entry in struts.xml for each action. So struts.xml usually is very small.
> > But we still have tiles.xml which needs an entry for each action. In big
> > applications that file becomes huge and hard to maintain.
> >
> > To fix that I created a bunch of Annotations and a struts2 result to be
> > able to create tile defs with annotations.
> >
> >
> > It would take me some time to turn that into a proper framework patch.
> >
> > Now my question is: Do you like that stuff?
> >
> >
> >
> > Sample application code:
> >
> >
> > --------------------------------------------
> > tiles.xml
> > --------------------------------------------
> > <tiles-definitions>
> >     <definition name=".default-layout" template=
> > "/WEB-INF/tiles/layout/layout.jsp">
> >         <put-attribute name="titleMsgKey" value=".titleMsgKey" />
> >         <put-attribute name="content" value=".content" />
> >     </definition>
> >
> >     <!-- no more entries ! -->
> >     <!-- except you have several layouts -->
> > </tiles-definitions>
> >
> >
> > --------------------------------------------
> > SampleAction
> > --------------------------------------------
> > @Result(name=SampleAction.INPUT, type="tiles-annotation")
> > @TileDef(
> >         extend=".default-layout",
> >         attributes={
> >                 @TileAttribute(name="titleMsgKey",
> value="text.key.test"),
> >                 @TileAttribute(name="content", value=
> > "/WEB-INF/tiles/test/test.jsp")
> >         }
> > )
> > public class SampleAction extends ActionSupport {
> > ...
> > }
> >
> >
> > --------------------------------------------
> > web.xml
> > --------------------------------------------
> >
> >         <!-- a parameter for TilesListener is required which I wrapped in
> > a specialized context listener -->
> >         <!-- that parameter is:
> >                 <param-name>
> > org.apache.tiles.factory.TilesContainerFactory.MUTABLE</param-name>
> >                 <param-value>true</param-value>
> >         -->
> >         <listener>
> >                 <listener-class>
> >  org.apache.struts2.tiles.StrutsTilesAnnotationsListener
> >                 </listener-class>
> >                 <init-param>
> >                         <param-name>
> > org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
> >                         <param-value>/WEB-INF/classes/tiles.xml</
> > param-value>
> >                 </init-param>
> >         </listener>
> >
> >
> >
> > regards,
> > Christoph
> >
> > This Email was scanned by Sophos Anti Virus
> >
>
>
>
> --
> Cheers,
> Paul
>

Reply via email to