You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Gonçalo Luiz <go...@gmail.com> on 2007/01/29 13:50:39 UTC

Struts 2 and tiles

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.xml files?
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@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2 and tiles

Posted by Joe Germuska <jo...@germuska.com>.
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 <go...@gmail.com> wrote:
>
> 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 <jo...@germuska.com> wrote:
> > 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@tiles mailing list to
> keep
> > up with status and changes.
> >
> > Joe
> >
> >
> > On 1/29/07, Gonçalo Luiz <goncalo.luiz@gmail.com > wrote:
> > >
> > > 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@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
> >
> >
> > --
> > Joe Germuska
> >  Joe@Germuska.com * http://blog.germuska.com
> >
> > "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@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Joe Germuska
Joe@Germuska.com * http://blog.germuska.com

"The truth is that we learned from João forever to be out of tune."
-- Caetano Veloso

Re: Struts 2 and tiles

Posted by Gonçalo Luiz <go...@gmail.com>.
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 <jo...@germuska.com> wrote:
> 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@tiles mailing list to keep
> up with status and changes.
>
> Joe
>
>
> On 1/29/07, Gonçalo Luiz <goncalo.luiz@gmail.com > wrote:
> >
> > 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.xml files?
> > 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@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>
> --
> Joe Germuska
>  Joe@Germuska.com * http://blog.germuska.com
>
> "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@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2 and tiles

Posted by Joe Germuska <jo...@germuska.com>.
That looks right to my eye.  I'd suggest setting your logging config to
"debug" for the category "org.apache.tiles.impl" (the class which
specifically handles the definitions is  BasicTilesContainer).  Perhaps that
will help.

I have to stress once again that Tiles 2 has not been released.  If you are
interested in using it, you have to be ready to get inside the code to
understand how it works until more documentation is written (and to be ready
to make changes to your code as changes get made to the framework, since
there's no specific backwards compatibility baseline we have to guarantee
for the first Tiles 2 release.)

Joe

On 1/30/07, Sai Nay Thurein Nyo <sa...@gmail.com> wrote:
>
>
> Hi Joe,
>
> I am testing on the tiles 2 to use in my new framework using Struts 2.
> I tried the following and it doesn't work.
> The tiles keep looking for the /WEB-INF/tiles.xml file which is default.
> All I need to do is simply add in the context parameter in web.xml right?
>
> <context-param>
>              <param-name>org.apache.tiles.DEFINITIONS_CONFIG</param-name>
>
> <param-value>/WEB-INF/tiles-common.xml,/WEB-INF/tiles-sample.xml
> </param-value>
>     </context-param>
>
> I did try a few other configurations with different params names such as
> "definition-config, tiles-definiation" also didn't working.
>
>
-- 
Joe Germuska
Joe@Germuska.com * http://blog.germuska.com

"The truth is that we learned from João forever to be out of tune."
-- Caetano Veloso

Re: Struts 2 and tiles

Posted by Sai Nay Thurein Nyo <sa...@gmail.com>.
Joe Germuska <joe <at> germuska.com> writes:

> 
> 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


Hi Joe,

I am testing on the tiles 2 to use in my new framework using Struts 2.
I tried the following and it doesn't work. 
The tiles keep looking for the /WEB-INF/tiles.xml file which is default. 
All I need to do is simply add in the context parameter in web.xml right?

 <context-param>
             <param-name>org.apache.tiles.DEFINITIONS_CONFIG</param-name>      
        
<param-value>/WEB-INF/tiles-common.xml,/WEB-INF/tiles-sample.xml</param-value>
    </context-param>

I did try a few other configurations with different params names such as
"definition-config, tiles-definiation" also didn't working.
Please enlighten me.

Thanks
Sai Nay Thurein Nyo


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2 and tiles

Posted by Joe Germuska <jo...@germuska.com>.
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@tiles mailing list to keep
up with status and changes.

Joe

On 1/29/07, Gonçalo Luiz <go...@gmail.com> wrote:
>
> 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.xml files?
> 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@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Joe Germuska
Joe@Germuska.com * http://blog.germuska.com

"The truth is that we learned from João forever to be out of tune."
-- Caetano Veloso