You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Michael Fortin <mi...@vendorpromotions.com> on 2005/06/08 18:54:48 UTC
velocity error page
Hello,
I've been trying to make a velocity error page but I've been having some
troubles. The correct velocity template gets displayed but the error
information doesn't seem to be in the request. For example the
attribute ${errorData.statusCode} and/or
${pageContext.errorData.throwable}appear in the page literally without
displaying their correct values. The same page written as a jsp using
jstl and EL works fine but I'd like to avoid using a mixed environment
of jsp and vm. Is there something else I have to do to pass those
values to the template?
My web.xml looks like:
<web-app ... version="2.4">
...
<servlet>
<servlet-name>velocity</servlet-name>
<servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</servlet-class>
<init-param>
<param-name>org.apache.velocity.toolbox</param-name>
<param-value>/WEB-INF/velocity.toolbox.xml</param-value>
</init-param>
</servlet>
...
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/error-500.vm</location>
</error-page>
...
Thanks in advance,
Michael
Re: velocity error page
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Michael,
> I've been trying to make a velocity error page but I've been having some
> troubles. The correct velocity template gets displayed but the error
> information doesn't seem to be in the request. For example the
> attribute ${errorData.statusCode} and/or
> ${pageContext.errorData.throwable}appear in the page literally without
> displaying their correct values. The same page written as a jsp using
> jstl and EL works fine but I'd like to avoid using a mixed environment
> of jsp and vm. Is there something else I have to do to pass those
> values to the template?
errorData/pageContext is a JSP thing. It doesn't apply to general
view components.
BUT, as stated in the servlet specs (SRV 9.9.1), corresponding request
attributes are set. You should be able to get them via the request.
$request.getAttribute("javax.servlet.error.status_code")
It might be a nice RFE to have them easily accessible to the Context,
though. ;)
Best regards,
-- Shinobu
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org