Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: Struts 2 and tiles

Joe Germuska

2007-01-29

Replies:

The struts-tiles-plugin depends on the nightly snapshot of Tiles 2, which
means that some things may get out of sync with the docs -- for instance,
we've recently been working on clarifying the names of some of the JSP tags
and I know for a fact some of the doc at tiles.apache.org is not in sync
with the current snapshot.

The example I gave is for using the TilesListener (ServletContextListener)
instead of the servlet, as in item (2) of the Confluence Wiki page (
http://cwiki.apache.org/S2PLUGINS/tiles-plugin.html) In this case, the
context-params are for the general Application Context and would probably go
right above your <filter> element for the Struts 2 FilterDispatcher.  I
have only just recently reconnected with Tiles development, but I suspect
that the TilesResult would work if you used the Servlet, but if you don't
intend to allow direct links to tiles, then there's no reason to use the
servlet; the Listener will take care of initializing the configurations, and
that's all that the Struts2 Tiles Plugin needs.

Note also that there are some differences in the DTD for Tiles2: more
attempts to simplify and clarify compared to Tiles1. The new DTD is at
http://struts.apache.org/dtds/tiles-config_2_0.dtd (although I guess we may
want to move it to tiles.apache.org before officially releasing Tiles 2.)
The main difference I can think of offhand is the XML attribute "path" in
the <definition> element in Tiles 1 becomes "template" in Tiles 2. That is
<definition name="xyz" template="/xyz.jsp" />

Joe

On 1/29/07, Gonçalo Luiz <goncalo.luiz@(protected):
>
> Hello Joe, thank you for your reply.
>
> In fact I had already saw
> http://cwiki.apache.org/S2PLUGINS/tiles-plugin.html, however I did not
> found any reference to an example of tiles-config.xml nor the version
> of the bundled Tiles (I assume from your answer that is tiles2).
>
> I'd still like to look into a tiles-config.xml example.
>
> Currently I'm using this configuration:
>
>      <servlet>
>           <servlet-name>tiles</servlet-name>
>           <servlet-class>org.apache.tiles.servlets.TilesServlet
> </servlet-class>
>           <init-param>
>                 <param-name>definitions-config</param-name>
>                 <param-value>/WEB-INF/tiles-config.xml
> </param-value>
>           </init-param>
>           <load-on-startup>1</load-on-startup>
>      </servlet>
>
>
> Where are you suggesting to add the context-param? Should
> <param-name>definitions-config</param-name> be
> <param-name>org.apache.tiles.DEFINITIONS_CONFIG</param-name> instead?
>
> Thank you once again.
>
> Best Regards,
> Gonçalo Luiz.
>
> On 29/01/07, Joe Germuska <joe@(protected):
> > Have you seen
> > http://cwiki.apache.org/S2PLUGINS/tiles-plugin.html ?
> >
> > Struts 2 is intentionally mostly ignorant of Tiles, except for the
> plugin,
> > so something like per-package tiles defs would involve writing your own
> > code, perhaps a custom subclass of the TilesResult. However, if you
> just
> > want to spread out your config among multiple files (which I like to
> do),
> > you just need to specify a context parameter like this:
> >
> >      <context-param>
> >
> > <param-name>org.apache.tiles.DEFINITIONS_CONFIG</param-name>
> >           <param-value>
> >                 /config/tiles/common.xml,
> >                 /config/tiles/create.xml,
> >                 /config/tiles/library.xml,
> >                 /config/tiles/profile.xml,
> >                 /config/tiles/login.xml
> >           </param-value>
> >      </context-param>
> >
> > While I think Tiles 2 is probably reasonably close to a release, it is
> still
> > under development, and documentation is one thing that is needed.
> > (Contributions are always welcome...)
> >
> > It doesn't have much traffic yet, but there is now a tiles user mailing
> list
> > -- see http://tiles.apache.org/mail-lists.html
> >
> > In the mean time, remember that it hasn't been released, so if you plan
> to
> > use it, you should probably subscribe to the dev@(protected)
> keep
> > up with status and changes.
> >
> > Joe
> >
> >
> > On 1/29/07, Gonçalo Luiz <goncalo.luiz@(protected):
> > >
> > > Hello,
> > >
> > > I'm developing a web application using struts2. I'm a struts1
> > > developer and now I'm migrating myself (not a specific app) to
> > > struts2.
> > >
> > > The documentation is very good so I managed to setup struts and run a
> > > few actions. The problem I found was in what it regards to Tiles.
> > > Despite the documentation refers the web.xml (the interceptor and
> > > configuration file) and struts.xml (return types) it does not show a
> > > tiles-configuration.xml example.
> > >
> > > I was used to have a tiles-configuration.xml for each subapplication
> > > (STRUTS2's namespace) and now it seems that there can be only one. I'm
> > > good with that, but I'd like to know the tiles-configuration.xml
> > > format.
> > >
> > > So, what I'd like to know is:
> > >
> > > 1 - is there any way to specify multiple tiles-configuration.xmlfiles?
> > > 2 - is there any way to associate a different tiles-configuration.xml
> > > file to each package
> > > 3 - is there an example of a tiles-configuration.xml usage with
> struts2?
> > > 4 - is tiles1 or tiles2 which comes bundled with struts2? Where can I
> > > find this info in documentation.
> > >
> > > Oh, planetstruts.org is down for at least 3 days, where can I report
> this?
> > >
> > > Best Regards,
> > > --
> > > Gonçalo Luiz
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> >
> >
> >
> > --
> > Joe Germuska
> > Joe@(protected)
> >
> > "The truth is that we learned from João forever to be out of tune."
> > -- Caetano Veloso
>
>
> --
> Gonçalo Luiz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Joe Germuska
Joe@(protected)

"The truth is that we learned from João forever to be out of tune."
-- Caetano Veloso
©2008 junlu.com - Jax Systems, LLC, U.S.A.