You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Yannick Haudry <yh...@gmail.com> on 2008/07/21 21:52:54 UTC

[s1] tiles2 plugin

Hi All,

I'm trying to migrate my S1 application using Tiles1 to Tiles2.
Here is the configuration:
Struts 1.3.9, Tiles 2.0.6 and struts-tiles2-1.4.0-SNAPSHOT.jar plugin.

I followed the migration guide from the Tiles2 website and got it
work, or almost !
Everything was working nicely until I used the export feature from
displaytag (see exception below)

Taking a much closer look at the processTilesDefinition method from
the TilesRequestProcessor class:

        if (container.isValidDefinition(definitionName, new Object[] { request,
                response })) {
            retValue = response.isCommitted();
            try {
                container.render(definitionName, new Object[] { request,
                        response });
            } catch (TilesException e) {
                throw new ServletException("Cannot render definition '"
                        + definitionName + "'");
            }


It appears that the retValue is always set to 'false' in any case,
hence in the log statement my '.page.View' is always processed as uri
and not as definition.
Then extending this class and setting the retValue to 'true' (which is
intuitively what I would do here) solved my issue with displaytag and
made it processed as tiles definition !

The bad thing is that I really don't know, what the
response.isCommitted(); is supposed to do (why it is always returning
false in my case), is the struts-tiles2-1.4.0 not compatible with my
struts version ?
any idea ?

Thanks
Yannick


StackTrace:

** Exception: java.lang.IllegalArgumentException: Path .page.View does
not start with a "/" character
** Message: Path .page.View does not start with a "/" character
** Cause: null
** Exception stackTrace:
java.lang.IllegalArgumentException: Path .species.compiled.View does
not start with a "/" character
	at org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:368)
	at org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(ApplicationContextFacade.java:196)
	at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
	at org.apache.struts.tiles2.TilesRequestProcessor.doForward(TilesRequestProcessor.java:158)
	at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:396)
	at org.apache.struts.tiles2.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:210)

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


Re: [s1] tiles2 plugin

Posted by Antonio Petrelli <an...@gmail.com>.
2008/7/22 Yannick Haudry <yh...@gmail.com>:
> Actually, referring to your last note, I was wondering if in this case
> (meaning Tiles2 without a plugin),
> can I still use Tiles definitions as Struts forward ?

No, but you can render your definition using the container directly,
with no forward. See:
http://tiles.apache.org/tutorial/basic/pages.html
(search for "Render the definition").

Antonio

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


Re: [s1] tiles2 plugin

Posted by Yannick Haudry <yh...@gmail.com>.
On Tue, Jul 22, 2008 at 9:29 AM, Antonio Petrelli
<an...@gmail.com> wrote:
> 2008/7/22 Yannick Haudry <yh...@gmail.com>:
>> or would it be a better idea to consider migrating to struts2 where
>> all the efforts are
>> concentrated now ?
>
> It depends. If you are maintaining an old application, then I suggest
> to follow the Struts 1 way.
> Otherwise, consider moving to another "modern" web framework, like
> Struts 2, Spring MVC, JSF, Seam, Click, etc.
> If you need to have a good integration with Tiles 2, Struts 2 and
> Spring MVC are the best choices. Anyway you can use Tiles 2 without an
> integration layer :-)
>

I'm already using Spring for other stuff but Struts2 is also very tempting,
and as my app is not that old and not that big, you're right it's just a matter
of choice and time to get throw it !

Actually, referring to your last note, I was wondering if in this case
(meaning Tiles2 without a plugin),
can I still use Tiles definitions as Struts forward ?
Do you have any pointer how to do that ?

> Ciao
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

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


Re: [s1] tiles2 plugin

Posted by Antonio Petrelli <an...@gmail.com>.
2008/7/22 Yannick Haudry <yh...@gmail.com>:
> or would it be a better idea to consider migrating to struts2 where
> all the efforts are
> concentrated now ?

It depends. If you are maintaining an old application, then I suggest
to follow the Struts 1 way.
Otherwise, consider moving to another "modern" web framework, like
Struts 2, Spring MVC, JSF, Seam, Click, etc.
If you need to have a good integration with Tiles 2, Struts 2 and
Spring MVC are the best choices. Anyway you can use Tiles 2 without an
integration layer :-)

Ciao
Antonio

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


Re: [s1] tiles2 plugin

Posted by Yannick Haudry <yh...@gmail.com>.
On Tue, Jul 22, 2008 at 8:47 AM, Antonio Petrelli
<an...@gmail.com> wrote:
> 2008/7/21 Yannick Haudry <yh...@gmail.com>:
>> Struts 1.3.9, Tiles 2.0.6 and struts-tiles2-1.4.0-SNAPSHOT.jar plugin.
>
> This configuration does not seem compatible to me. You have to try
> with a snapshot of Struts 1.4.0.

will try that but it seems to be related to the Tiles2 plugin itself.
By the way, do you have a chance to get a new struts1 release in the near
feature (including Tiles2-plugin) ? the last release is almost 1 year old,
and a bit more for the GA :(
or would it be a better idea to consider migrating to struts2 where
all the efforts are
concentrated now ?

>
>> I followed the migration guide from the Tiles2 website and got it
>> work, or almost !
>> Everything was working nicely until I used the export feature from
>> displaytag (see exception below)
>>
>> Taking a much closer look at the processTilesDefinition method from
>> the TilesRequestProcessor class:
>>
>>        if (container.isValidDefinition(definitionName, new Object[] { request,
>>                response })) {
>>            retValue = response.isCommitted();
>>            try {
>>                container.render(definitionName, new Object[] { request,
>>                        response });
>>            } catch (TilesException e) {
>>                throw new ServletException("Cannot render definition '"
>>                        + definitionName + "'");
>>            }
>>
>>
>> It appears that the retValue is always set to 'false' in any case,
>> hence in the log statement my '.page.View' is always processed as uri
>> and not as definition.
>
> Yuk! It seems that you found a bug!
> In fact the "retValue" was supposed to be true if a definition was
> found. But in fact it was misused.
> Can you open a JIRA issue?
> https://issues.apache.org/struts/browse/STR
> (use the "tiles2-plugin")
> If you can, can you create a patch about it?

sure.
thanks Antonio for you fast reply.

Yannick

>
> Thanks
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

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


Re: [s1] tiles2 plugin

Posted by Antonio Petrelli <an...@gmail.com>.
2008/7/21 Yannick Haudry <yh...@gmail.com>:
> Struts 1.3.9, Tiles 2.0.6 and struts-tiles2-1.4.0-SNAPSHOT.jar plugin.

This configuration does not seem compatible to me. You have to try
with a snapshot of Struts 1.4.0.

> I followed the migration guide from the Tiles2 website and got it
> work, or almost !
> Everything was working nicely until I used the export feature from
> displaytag (see exception below)
>
> Taking a much closer look at the processTilesDefinition method from
> the TilesRequestProcessor class:
>
>        if (container.isValidDefinition(definitionName, new Object[] { request,
>                response })) {
>            retValue = response.isCommitted();
>            try {
>                container.render(definitionName, new Object[] { request,
>                        response });
>            } catch (TilesException e) {
>                throw new ServletException("Cannot render definition '"
>                        + definitionName + "'");
>            }
>
>
> It appears that the retValue is always set to 'false' in any case,
> hence in the log statement my '.page.View' is always processed as uri
> and not as definition.

Yuk! It seems that you found a bug!
In fact the "retValue" was supposed to be true if a definition was
found. But in fact it was misused.
Can you open a JIRA issue?
https://issues.apache.org/struts/browse/STR
(use the "tiles2-plugin")
If you can, can you create a patch about it?

Thanks
Antonio

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