You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Ray Clough <rc...@kamakuraco.com> on 2007/06/14 22:05:30 UTC
Tiles documentation
It seems to me that the config info at
http://tiles.apache.org/tutorial/configuration.html is incomplete and in
error. 1) There is no filter-mapping or servlet-mapping specified. 2)
the tiles definition files are specified both for the servlet and the
filter. There is no statement about using one or the other. The only
other instruction is the alternative of using a context parameter.
How is the mapping to be specified. My guess is that if the filter and
servlet are mapped to "*.tiles", for example, all forwards to
"xxx.tiles" will be rendered by Tiles. Is that correct? Do both the
filter and servlet need to be mapped. If either is not mapped, is it
actually used? Must they be mapped to the same value?
Thanks,
- Ray Clough
Re: Tiles documentation
Posted by Antonio Petrelli <an...@gmail.com>.
2007/6/18, Ray Clough <ra...@allthisisthat.com>:
I am now considering removing the
> S2 plugin and simply using T2 dispatching. This would allow me to use the
> latest Tiles-2.0.4 version, instead of 2.0.3 which ships with Struts-2.0.8.
I hope that this problem will be resolved soon. Probably we need to
release a S2/T2 plugin that supports Tiles 2.0.4.
> Again, thank you for your help. If you would like, I'd be happy to write
> these steps more formally for use in your Migration Guide.
That would be great! The Maven site is in:
http://svn.apache.org/repos/asf/tiles/site/
so, if you want, you can write a patch. The "problem" is that only a
little part of your experience will go into this part of documentation
(in particular, the part of removing the libraries and old
configuration).
So, probably, your experience could be put into Confluence wiki:
http://cwiki.apache.org/confluence/display/TILES/Index
If you already signed a CLA, then you have write access, or if you
can't, ask the Tiles developers list to activate you.
But if you did not sign a CLA, see:
http://www.apache.org/licenses/
Under "Contributor License Agreement".
Thanks a lot! And thanks in advance :-)
Antonio
Re: Tiles documentation
Posted by Ray Clough <ra...@allthisisthat.com>.
Thanks Antonio. I finally got it working. The app is now S2 (using plugin)
and S1 (no plugin) both using Tiles 2, and sharing the same tiles
definitions. It works well. The app was already configured to run S2/T2
(with plugin) and S1/T1 (with plugin). I am now considering removing the
S2 plugin and simply using T2 dispatching. This would allow me to use the
latest Tiles-2.0.4 version, instead of 2.0.3 which ships with Struts-2.0.8.
As a summary, here are the steps I went thru:
1. The web.xml file already contained the TilesListener for the S2
deployment. The Listener class was changed for the new deployment:
<listener>
<listener-class>
org.apache.tiles.listener.TilesListener
</listener-class>
</listener>
2. The web.xml file already contained context-param elems for
ContainerFactory and DEFINITIONS_CONFIG. The Definitions config element
changed to the Tiles reference:
<context-param>
<param-name>org.apache.tiles.CONTAINER_FACTORY</param-name>
<param-value>
org.apache.struts2.tiles.StrutsTilesContainerFactory
</param-value>
</context-param>
<context-param>
<param-name>
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
3. In web.xml, added a reference to the Tiles Dispatch Servlet, and mapped
it to "*.tiles":
<servlet>
<servlet-name>Tiles Dispatch Servlet</servlet-name>
<servlet-class>
org.apache.tiles.web.TilesDispatchServlet
</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Tiles Dispatch Servlet</servlet-name>
<url-pattern>*.tiles</url-pattern>
</servlet-mapping>
4. In WEB-INF/lib, deleted the file 'struts-tiles-1.3.8.jar'.
5. In struts-config.xml, removed the elements for the Tiles plugin, and the
TilesRequestProcessor.
6. For the S1 actions, modified the struts-config.xml file to call the
Tile. Note that the leading "/" is required, and the suffix ".tiles" is
used in the forward element. (When using plugin, no leading "/" was used).
<action path="/BookACruise"
type="greetings.struts1.BookEarthCruiseSetupAction" >
<forward name="success" path="/BOOK_TRIP_TO_EARTH.tiles" />
</action>
7. Deleted the Tiles-1 mapping file, tiles-defs.xml, after moving the
definitions to the shared S2 tiles definitions file, tiles.xml. (Note there
is no '.tiles' suffix, as I always specified when using the plugin) Update
the definitions elements to the T2 syntax.
<definition name="BOOK_TRIP_TO_EARTH"
extends="BaseScreenTemplate">
<put-attribute name="title" value="Struts-1 with Tiles-2" type="string"/>
<put-attribute name="contents" value="/jsp/BookEarthCruise.jspx" />
</definition>
8. Previously, had a special T1 template file, using T1 syntax, but
otherwise identical to the T2 template. Deleted the T1-template file.
9. Upgraded the jsp page syntax for the T2 tags.
Again, thank you for your help. If you would like, I'd be happy to write
these steps more formally for use in your Migration Guide.
- Ray Clough
Ray Clough-2 wrote:
>
> It seems to me that the config info at
> http://tiles.apache.org/tutorial/configuration.html is incomplete and in
> error. 1) There is no filter-mapping or servlet-mapping specified. 2)
> the tiles definition files are specified both for the servlet and the
> filter. There is no statement about using one or the other. The only
> other instruction is the alternative of using a context parameter.
>
> How is the mapping to be specified. My guess is that if the filter and
> servlet are mapped to "*.tiles", for example, all forwards to
> "xxx.tiles" will be rendered by Tiles. Is that correct? Do both the
> filter and servlet need to be mapped. If either is not mapped, is it
> actually used? Must they be mapped to the same value?
>
> Thanks,
> - Ray Clough
>
>
>
--
View this message in context: http://www.nabble.com/Tiles-documentation-tf3923991.html#a11180978
Sent from the tiles users mailing list archive at Nabble.com.
Re: Tiles documentation
Posted by Antonio Petrelli <an...@gmail.com>.
2007/6/16, Ray Clough <ra...@allthisisthat.com>:
> The S2/T2 pages work fine, but not the S1/T2 pages.
Your problem is that the ".tiles" requests cannot be served, because
you did not specify the TilesDispatchServlet.
You can either use TilesDispatchServlet, or the very experimental
S1-T2 plugin (in this case, you have to make a Struts configuration,
as you probably did in your S1-T1 application):
http://svn.apache.org/repos/asf/struts/struts1/trunk/tiles2/
Antonio
Re: Tiles documentation
Posted by Ray Clough <ra...@allthisisthat.com>.
The error I'm getting is: javax.servlet.ServletException: Path
BOOK_TRIP_TO_EARTH.tiles does not start with a "/" character
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)
where the BookTripToEarthAction is a S1 action. (the app is like
HelloWorld, but from the Martian's view, it becomes "GreetingsEarth")
I have the following parameters in web.xml
<context-param>
<param-name>org.apache.tiles.CONTAINER_FACTORY</param-name>
<param-value>
org.apache.struts2.tiles.StrutsTilesContainerFactory
</param-value>
</context-param>
<context-param>
<param-name>
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
and the Tiles Listener as:
<listener>
<listener-class>
org.apache.tiles.listener.TilesListener
</listener-class>
</listener>
The same error when I change the Tiles Container Factory to:
org.apache.tiles.factory.TilesContainerFactory
The S2/T2 pages work fine, but not the S1/T2 pages.
Any Suggestions? Thx,
- Ray Clough
Antonio Petrelli-3 wrote:
>
> 2007/6/15, Ray Clough <rc...@kamakuraco.com>:
>> So far, it doesn't work.
>
> It seems that you have done everything. What is your exact problem?
>
>> 3. in web-xml add the specified servlet reference. If the config
>> parameter is incorrect on the web site, what should it be?
>
> org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
> For other parameters, see:
> http://tiles.apache.org/config-reference.html
>
>> Note that the TilesListener is already specified
>> in the web.xml file because it was needed for Struts-2/Tiles-2. Could I
>> get by without specifying the Tiles Servlet, and just use a config param
>> to specify the tiles.xml file as the tiles definition source?
>
> If you mean a "context" parameter, then yes. You can drop TilesServlet
> and use TilesListener instead.
>
>>
>> It seems like T2 is intercepting and rendering responses ending in
>> "*.tiles". Is that correct, and is it configurable? My habit has been
>> to use "*.screen" as my Tiles pages mappings.
>
> It's the "TilesDispatchServlet" and currently it is not configurable
> (it lacks some code).
> http://tiles.apache.org/tutorial/advanced/utils.html
> Anyway, if you want to write a patch to make it configurable, we'll be
> happy :-)
>
>>
>> Finally, what would be needed to make S2 work with T2, but not using the
>> Struts-Tiles plugin? It seems to me that one of the weaknesses of the
>> S2 architecture is using a single rendering scheme by specifying a
>> 'type' for the result mappings. This precludes compound rendering
>> types, like jsf-tiles inside S2. That is, I can't have a page with some
>> portions rendered as JSF, some non-JSF, and use Tiles to compose them.
>
> Using S2/T2 plugin does not preclude, AFAIK, using JSF (you should ask
> the Struts Users mailing list for this to be sure). The integration
> between S2 and T2 is only in the result type and in the startup and
> processing.
>
>>
>> As to how the documentation could be clearer about use of servlet OR
>> filter OR listener - I misunderstood it, but would have understood a
>> sentence like: "To configure your application to use Tiles-2, you need
>> to modify the web-xml file to specify using either (1) the TilesServlet,
>> or (2) the TilesFilter, or (3) the TilesListener. The required elements
>> are shown below: ....."
>
> I just updated the site in another way, wait about an hour and see if it
> is ok.
>
>>
>> Also the migration guide does not address some of the steps I specified
>> above, like removing the struts-tiles-xxx.jar file, or removing the
>> tiles-processor and tiles-plugin elements from the struts-config.xml
>> file. I guess those steps are required, but the documentation never
>> told me that, only my previous experience. Lots of people haven't any
>> previous experience to guide them.
>
> Well thanks! Why don't you open an issue for that? Remember to use the
> "TILESSHARED" project.
> If you want you can write a patch for the site. We always welcome help
> by others.
>
> Ciao
> Antonio
>
>
--
View this message in context: http://www.nabble.com/Tiles-documentation-tf3923991.html#a11157683
Sent from the tiles users mailing list archive at Nabble.com.
Re: Tiles documentation
Posted by Antonio Petrelli <an...@gmail.com>.
2007/6/15, Ray Clough <rc...@kamakuraco.com>:
> So far, it doesn't work.
It seems that you have done everything. What is your exact problem?
> 3. in web-xml add the specified servlet reference. If the config
> parameter is incorrect on the web site, what should it be?
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
For other parameters, see:
http://tiles.apache.org/config-reference.html
> Note that the TilesListener is already specified
> in the web.xml file because it was needed for Struts-2/Tiles-2. Could I
> get by without specifying the Tiles Servlet, and just use a config param
> to specify the tiles.xml file as the tiles definition source?
If you mean a "context" parameter, then yes. You can drop TilesServlet
and use TilesListener instead.
>
> It seems like T2 is intercepting and rendering responses ending in
> "*.tiles". Is that correct, and is it configurable? My habit has been
> to use "*.screen" as my Tiles pages mappings.
It's the "TilesDispatchServlet" and currently it is not configurable
(it lacks some code).
http://tiles.apache.org/tutorial/advanced/utils.html
Anyway, if you want to write a patch to make it configurable, we'll be happy :-)
>
> Finally, what would be needed to make S2 work with T2, but not using the
> Struts-Tiles plugin? It seems to me that one of the weaknesses of the
> S2 architecture is using a single rendering scheme by specifying a
> 'type' for the result mappings. This precludes compound rendering
> types, like jsf-tiles inside S2. That is, I can't have a page with some
> portions rendered as JSF, some non-JSF, and use Tiles to compose them.
Using S2/T2 plugin does not preclude, AFAIK, using JSF (you should ask
the Struts Users mailing list for this to be sure). The integration
between S2 and T2 is only in the result type and in the startup and
processing.
>
> As to how the documentation could be clearer about use of servlet OR
> filter OR listener - I misunderstood it, but would have understood a
> sentence like: "To configure your application to use Tiles-2, you need
> to modify the web-xml file to specify using either (1) the TilesServlet,
> or (2) the TilesFilter, or (3) the TilesListener. The required elements
> are shown below: ....."
I just updated the site in another way, wait about an hour and see if it is ok.
>
> Also the migration guide does not address some of the steps I specified
> above, like removing the struts-tiles-xxx.jar file, or removing the
> tiles-processor and tiles-plugin elements from the struts-config.xml
> file. I guess those steps are required, but the documentation never
> told me that, only my previous experience. Lots of people haven't any
> previous experience to guide them.
Well thanks! Why don't you open an issue for that? Remember to use the
"TILESSHARED" project.
If you want you can write a patch for the site. We always welcome help
by others.
Ciao
Antonio
Re: Tiles documentation
Posted by Ray Clough <rc...@kamakuraco.com>.
Thanks Antonio. What I'm trying to do is migrate the S1/T1 part of a
large S1/S2 app to use Tiles-2. That way, I will be able to include
parts of pages generated from S1 actions inside pages generated by S2
actions.
So far, it doesn't work. These are the steps I've taken:
1. remove 'struts-tiles-1.3.8.jar'
2. in struts-config.xml, remove the tiles-processor and tiles-plugin
sections
3. in web-xml add the specified servlet reference. If the config
parameter is incorrect on the web site, what should it be? Specify
WEB-INF/tiles.xml as the tiles-definitions file. Remove the previous
tiles-defs.xml file
4. added the tiles definition to my T2 tiles.xml file.
5. fixed the tiles tags in the jsp pages to use the new element names
and attribute names.
Am I missing anything? Note that the TilesListener is already specified
in the web.xml file because it was needed for Struts-2/Tiles-2. Could I
get by without specifying the Tiles Servlet, and just use a config param
to specify the tiles.xml file as the tiles definition source?
It seems like T2 is intercepting and rendering responses ending in
"*.tiles". Is that correct, and is it configurable? My habit has been
to use "*.screen" as my Tiles pages mappings.
Finally, what would be needed to make S2 work with T2, but not using the
Struts-Tiles plugin? It seems to me that one of the weaknesses of the
S2 architecture is using a single rendering scheme by specifying a
'type' for the result mappings. This precludes compound rendering
types, like jsf-tiles inside S2. That is, I can't have a page with some
portions rendered as JSF, some non-JSF, and use Tiles to compose them.
As to how the documentation could be clearer about use of servlet OR
filter OR listener - I misunderstood it, but would have understood a
sentence like: "To configure your application to use Tiles-2, you need
to modify the web-xml file to specify using either (1) the TilesServlet,
or (2) the TilesFilter, or (3) the TilesListener. The required elements
are shown below: ....."
Also the migration guide does not address some of the steps I specified
above, like removing the struts-tiles-xxx.jar file, or removing the
tiles-processor and tiles-plugin elements from the struts-config.xml
file. I guess those steps are required, but the documentation never
told me that, only my previous experience. Lots of people haven't any
previous experience to guide them.
To me, Tiles was always the single best feature of Struts, and I am
really glad to see it evolving on its own.
Thanks,
- Ray Clough
Antonio Petrelli wrote:
> 2007/6/14, Ray Clough <rc...@kamakuraco.com>:
>>
>> It seems to me that the config info at
>> http://tiles.apache.org/tutorial/configuration.html is incomplete and in
>> error. 1) There is no filter-mapping or servlet-mapping specified.
>
>
>
> It is not necessary. The TilesServlet is not a request/response servlet,
> but only a startup servlet. What I mean is that it is needed to
> initialize
> Tiles, not to serve requests.
>
> 2) the tiles definition files are specified both for the servlet and the
>> filter. There is no statement about using one or the other. The only
>> other instruction is the alternative of using a context parameter.
>
>
>
> Maybe it isn't clear that using a TilesServlet, TilesListener or
> TilesFilter
> are mutually exclusive: use it and discard the others... How do you
> suggest
> to change the sentences?
>
>
> How is the mapping to be specified. My guess is that if the filter and
>> servlet are mapped to "*.tiles", for example, all forwards to
>> "xxx.tiles" will be rendered by Tiles. Is that correct? Do both the
>> filter and servlet need to be mapped. If either is not mapped, is it
>> actually used? Must they be mapped to the same value?
>
>
>
> I think that you are referring to this:
> http://tiles.apache.org/tutorial/advanced/utils.html
>
> Thanks
> Antonio
>
> P.S. The Tiles configuration parameter that is used to specify Tiles
> definition files in:
> http://tiles.apache.org/tutorial/configuration.html
> is not correct, I will fix it ASAP.
>
Re: Tiles documentation
Posted by Antonio Petrelli <an...@gmail.com>.
2007/6/14, Ray Clough <rc...@kamakuraco.com>:
>
> It seems to me that the config info at
> http://tiles.apache.org/tutorial/configuration.html is incomplete and in
> error. 1) There is no filter-mapping or servlet-mapping specified.
It is not necessary. The TilesServlet is not a request/response servlet,
but only a startup servlet. What I mean is that it is needed to initialize
Tiles, not to serve requests.
2) the tiles definition files are specified both for the servlet and the
> filter. There is no statement about using one or the other. The only
> other instruction is the alternative of using a context parameter.
Maybe it isn't clear that using a TilesServlet, TilesListener or TilesFilter
are mutually exclusive: use it and discard the others... How do you suggest
to change the sentences?
How is the mapping to be specified. My guess is that if the filter and
> servlet are mapped to "*.tiles", for example, all forwards to
> "xxx.tiles" will be rendered by Tiles. Is that correct? Do both the
> filter and servlet need to be mapped. If either is not mapped, is it
> actually used? Must they be mapped to the same value?
I think that you are referring to this:
http://tiles.apache.org/tutorial/advanced/utils.html
Thanks
Antonio
P.S. The Tiles configuration parameter that is used to specify Tiles
definition files in:
http://tiles.apache.org/tutorial/configuration.html
is not correct, I will fix it ASAP.