You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Bill <bh...@collaborativefusion.com> on 2002/12/18 19:40:17 UTC

Re: Exception and setScreenTemplate( "Error.vm" )

To the best of my knowledge, the screen class is always executed when
you access the template.  This at the very least has been my experience
to date.  So I'm going to ask the obvious:  

Does the package for Error.java correspond to the same hierarchy as the
template file?

For instance:

If Error.vm is in a directory called Errors -->

templates/app/screens/Errors/Error.java

Then the screen class has to be in -->

WEB-INF/src/java/com/yourcom/yourapp/modules/screens/Errors/Error.java

Next obvious question, have you found anything of interest in the logs?

-b

On Wed, 2002-12-18 at 22:51, Akshay Kapur wrote:
> When my application screen Home.vm throws Exception, the following code in 
> the catch block gets executed -
> 
>          catch( Exception e )
>          {
>              data.getTemplateInfo().setScreenTemplate(  "Error.vm"  );
> 
>              return;
>          }
> 
> In Error.vm, there are Velocity $variables that are assumed to have been 
> set in the context by Error.java.
> 
> However, it seems that Error.java doesn't get called and the Velocity 
> $variables are null when the template gets displayed. I guess the reason is 
> that Error.java will only get called if Error.vm is accessed directly. If 
> this reason is correct, how do I solve this design issue?
> 
> Thanks
> Akshay



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Exception and setScreenTemplate( "Error.vm" )

Posted by Akshay Kapur <ak...@cisco.com>.
Thanks Bill for your response. However as I discovered later, the 
resolution to my issue is the following syntax -

         catch( Exception e )
         {
             this.doRedirect( data, "Error.vm" );

             return;
         }

The explanation is given at the following URL 
http://jakarta.apache.org/turbine/turbine-2/apidocs/org/apache/turbine/modules/screens/TemplateScreen.html#doRedirect(org.apache.turbine.util.RunData,%20java.lang.String)

Regards,
Akshay

At 06:40 PM 12/18/2002 +0000, Bill wrote:
>To the best of my knowledge, the screen class is always executed when
>you access the template.  This at the very least has been my experience
>to date.  So I'm going to ask the obvious:
>
>Does the package for Error.java correspond to the same hierarchy as the
>template file?
>
>For instance:
>
>If Error.vm is in a directory called Errors -->
>
>templates/app/screens/Errors/Error.java
>
>Then the screen class has to be in -->
>
>WEB-INF/src/java/com/yourcom/yourapp/modules/screens/Errors/Error.java
>
>Next obvious question, have you found anything of interest in the logs?
>
>-b
>
>On Wed, 2002-12-18 at 22:51, Akshay Kapur wrote:
> > When my application screen Home.vm throws Exception, the following code in
> > the catch block gets executed -
> >
> >          catch( Exception e )
> >          {
> >              data.getTemplateInfo().setScreenTemplate(  "Error.vm"  );
> >
> >              return;
> >          }
> >
> > In Error.vm, there are Velocity $variables that are assumed to have been
> > set in the context by Error.java.
> >
> > However, it seems that Error.java doesn't get called and the Velocity
> > $variables are null when the template gets displayed. I guess the 
> reason is
> > that Error.java will only get called if Error.vm is accessed directly. If
> > this reason is correct, how do I solve this design issue?
> >
> > Thanks
> > Akshay
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>