You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Kelvin Tan <ke...@relevanz.com> on 2001/07/14 10:58:18 UTC

Incorrectly formatted templates

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(VelocityServlet.java:3
33) at
org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:294)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at
org.apache.tomcat.core.Handler.service(Handler.java:287) at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213) at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)

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.


Re: Incorrectly formatted templates

Posted by Kelvin Tan <ke...@relevanz.com>.
Sorry I omitted the fact that I'm using Velocity 1.01.

----- Original Message -----
From: "Kelvin Tan" <ke...@relevanz.com>
To: <ve...@jakarta.apache.org>
Sent: Saturday, July 14, 2001 4:58 PM
Subject: Incorrectly formatted templates


> 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(VelocityServlet.java:3
> 33) at
>
org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:294)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at
> org.apache.tomcat.core.Handler.service(Handler.java:287) at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at
>
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
> 7) at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> onnectionHandler.java:213) at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
> at java.lang.Thread.run(Thread.java:484)
>
> 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.
>
>


Re: Incorrectly formatted templates

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
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.

geir


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(VelocityServlet.java:3
> 33) at
> org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:294)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at
> org.apache.tomcat.core.Handler.service(Handler.java:287) at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
> 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> onnectionHandler.java:213) at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
> at java.lang.Thread.run(Thread.java:484)
> 
> 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.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!