velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject Processing Templates with #parse
Date Thu, 07 Jul 2005 03:22:49 GMT

I'm new to velocity. I'm trying to get the integration of velocity and
struts going.

VelocityViewServlet is being used to handle all the calls to *.vm files.

Find below the snippet from web.xml:




Also a piece of struts-config:
<action path="/jsp/home" type="presentation.availability.HomeAction">
  <forward name="HomePage"
path="/templates/availability/homepagetemplate.vm" />

The properties set in are:

file.resource.loader.path = templates
runtime.log = velocity.log

While processing homepagetemplate, ResourceNotFoundException is thrown
because it has


It tries to find the template directly under the web app working
directory and not from the root specified from the properties file
I guess processing the "homepagetemplate.vm" was fine because
strutsconfig has the complete path.

Could some one point me out the point at which i'm doing it incorrectly?

I also found this piece of code in VelocityViewServlet:

protected Template handleRequest(HttpServletRequest request,
                                     HttpServletResponse response,
                                     Context ctx)
        throws Exception
        // If we get here from RequestDispatcher.include(),
        // will return the original (wrong) URI requested.  The
following special
        // attribute holds the correct path.  See section 8.3 of the
        // 2.3 specification.
        String path =
        if (path == null)
            path = request.getServletPath();
        return getTemplate(path);

This always returns the template name from the servletPath(). So when
would the VelocityContext properties (for root of template etc.) be

Another query in this context is - where is VelocityContext information
stored after the init() method of the VelocityViewServlet. (I did find
the TooblBoxContext in the ChainedContext, but not VelocityContext

Thank you,

Confidentiality Notice

The information contained in this electronic message and any attachments to this message are
for the exclusive use of the addressee(s) and may contain confidential or privileged information.
you are not the intended recipient, please notify the sender at Wipro or
and destroy all copies of this message and any attachments.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message