You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Valery Jacot <vj...@eim.ch> on 2003/05/26 16:06:17 UTC
how to catch exception using tiles ???
Hello all struts user...
I would like to know if somebody has already tried to catch the exceptions
thrown in a jsp template that is called by a <tiles:insert ...> in a JSP
page. It is to have own exceptions handling and own exceptions treatment.
If somebody has an idea... Thanks...
Valery
***********************************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager to postmaster@eim.ch
***********************************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: how to catch exception using tiles ???
Posted by Cedric Dumoulin <ce...@apache.org>.
Originally, it was possible to use the jsp page directive <@ page
|errorPage="|relativeURL @> on a nested tile bases| |for error/exception
handling. But this doesn't work anymore.
I have no simple solution. You can try one of the following:
* Put a surrounding try/catch block in the tile throwing an
exception, and treat the exception from there.
* Change the <insert ...> tag behavior by changing the
implementation of InsertTag.java. Look for the method
processException(...). All is happening here. You can either
provide your own new tag, or change the original tag behavior.
* Avoid throwing an exception in a Tile. This is certainly the best
way :-). Page rendering should normally not throw an exception. If
you have an action or controller throwing an exception, consider
using a Struts action with associated exception mechanism, or
catch the exception in the action and do a forward accordingly.
* Wait for the next release which will provide a better exception
handling mechanism. This can take some times :-(
Cedric
Thomas Oldervoll wrote:
>Cedric Dumoulin <ce...@apache.org> writes:
>
>
>
>> Actually, the <tiles:insert ...> tag catch all the exceptions and
>>show the message in place of the tile. This behavior help developing a
>>complex page made of several tiles. If you set the logging level to
>>"debug", the complete exception stack trace will be shown.
>>
>>
>
>This behavoiur actually causes a problem for me. I want to show a
>pretty error message when a page or a tile failes. I use my own
>RequestController, a subclass of TilesRequestController. To handle
>page faults I have added a method process() that calls super.process()
>surrounded by a try/catch-block. I wanted to do the same thing for
>each tile, so I tried implementing processInclude(). This didn't work
>since <tiles:insert> never calls processInclude(). Investigating other
>options, I can't find any way to get <tiles:insert> to not print out
>the exception on the JSP and rather let me decide want to do.
>
>What I want is:
>- no generated exception message in the HTML output
>- the ability to print my own error message and log the error, or
>maybe even try to get hold of some cached content to use instead.
>
>Any tips for how to achieve this?
>
>--
>Thomas Oldervoll, Zenior AS
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: how to catch exception using tiles ???
Posted by Thomas Oldervoll <th...@java.no>.
Cedric Dumoulin <ce...@apache.org> writes:
> Actually, the <tiles:insert ...> tag catch all the exceptions and
> show the message in place of the tile. This behavior help developing a
> complex page made of several tiles. If you set the logging level to
> "debug", the complete exception stack trace will be shown.
This behavoiur actually causes a problem for me. I want to show a
pretty error message when a page or a tile failes. I use my own
RequestController, a subclass of TilesRequestController. To handle
page faults I have added a method process() that calls super.process()
surrounded by a try/catch-block. I wanted to do the same thing for
each tile, so I tried implementing processInclude(). This didn't work
since <tiles:insert> never calls processInclude(). Investigating other
options, I can't find any way to get <tiles:insert> to not print out
the exception on the JSP and rather let me decide want to do.
What I want is:
- no generated exception message in the HTML output
- the ability to print my own error message and log the error, or
maybe even try to get hold of some cached content to use instead.
Any tips for how to achieve this?
--
Thomas Oldervoll, Zenior AS
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: how to catch exception using tiles ???
Posted by Cedric Dumoulin <ce...@apache.org>.
Hi,
Actually, the <tiles:insert ...> tag catch all the exceptions and show
the message in place of the tile. This behavior help developing a
complex page made of several tiles. If you set the logging level to
"debug", the complete exception stack trace will be shown.
Cedric
Valery Jacot wrote:
>Hello all struts user...
>
>I would like to know if somebody has already tried to catch the exceptions
>thrown in a jsp template that is called by a <tiles:insert ...> in a JSP
>page. It is to have own exceptions handling and own exceptions treatment.
>
>If somebody has an idea... Thanks...
>
>Valery
>
>
>
>***********************************************************************************
>
>This email and any files transmitted with it are confidential and
>intended solely for the use of the individual or entity to whom they
>are addressed. If you have received this email in error please notify
>the system manager to postmaster@eim.ch
>
>***********************************************************************************
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: how to catch exception using tiles ???
Posted by Cedric Dumoulin <ce...@apache.org>.
Hi,
Actually, the <tiles:insert ...> tag catch all the exceptions and show
the message in place of the tile. This behavior help developing a
complex page made of several tiles. If you set the logging level to
"debug", the complete exception stack trace will be shown.
Cedric
Valery Jacot wrote:
>Hello all struts user...
>
>I would like to know if somebody has already tried to catch the exceptions
>thrown in a jsp template that is called by a <tiles:insert ...> in a JSP
>page. It is to have own exceptions handling and own exceptions treatment.
>
>If somebody has an idea... Thanks...
>
>Valery
>
>
>
>***********************************************************************************
>
>This email and any files transmitted with it are confidential and
>intended solely for the use of the individual or entity to whom they
>are addressed. If you have received this email in error please notify
>the system manager to postmaster@eim.ch
>
>***********************************************************************************
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org