velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <>
Subject Re: Incorrectly formatted templates
Date Sat, 14 Jul 2001 12:29:32 GMT
Yes... in Velocity 1.1, there are two handleRequest() methods.  The
better one to use is
handleRequest( HttpServletRequest, HttpServletResponse, Context)...

The thing to make sure you do in handleRequest() is catch the Exceptions
from getTemplate() - that is where the parsing would be done, so you
would then know if you had a syntax problem, and could then take steps
to deal with it.

Take a look a the Javadoc to see what getTemplate() will throw.


Kelvin Tan wrote:
> I've found it somewhat odd that if I don't format my Velocity templates
> correctly in the case of servlets (omitting a #end or using #if(dfdf)
> instead of #if($dfdf)), the error returned is
> VelocityServlet : Error processing the template
> java.lang.Exception: handleRequest(Context) returned null - no template
> selected!
> java.lang.Exception: handleRequest(Context) returned null - no template
> selected! at
> org.apache.velocity.servlet.VelocityServlet.handleRequest(VelocityServlet.ja
> va:561) at
> org.apache.velocity.servlet.VelocityServlet.doRequest(
> 33) at
> org.apache.velocity.servlet.VelocityServlet.doGet(
> at javax.servlet.http.HttpServlet.service( at
> javax.servlet.http.HttpServlet.service( at
> org.apache.tomcat.core.ServletWrapper.doService( at
> org.apache.tomcat.core.Handler.service( at
> org.apache.tomcat.core.ServletWrapper.service( at
> org.apache.tomcat.core.ContextManager.internalService(
> 7) at org.apache.tomcat.core.ContextManager.service(
> at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt( at
> org.apache.tomcat.util.ThreadPool$
> at
> Now, is this supposed to be the way it is, or am I not setting something up
> correctly.
> If this is the way it is, I must say the error message is not exactly very
> helpful, since it was more a problem with my template, rather than that "no
> template (had been) selected".
> Thanks.

Geir Magnusson Jr.                 
System and Software Consulting
Developing for the web?  See
You have a genius for suggesting things I've come a cropper with!

View raw message