Dear Sir/Madam,

I'm trying to build JSP's with the Velocity template engine.  I
installed Velocity successfully and even the veltag.tld.
However when I do a request to an jsp I get the following Error.

org.apache.velocity.exception.ResourceNotFoundException : Unable to find
resource 'test.vm'.

The template test.vm is in the same map as the JSP.  Could there be a
specific directory to put the template?

The sources are included at the bottom of the page.

Thanks in advance!

*
The Template*
#foreach( $name in $list)
   $name is in the house.<BR>

*The JSP*

<html><head><title> Velocity! </title></head>
<body>
<jsp:useBean id="example" class="velocity.ExampleVelocity" scope="request"/>

</body>
</html>
*
The Class*

> package velocity;
>
> import org.apache.velocity.*;
> import org.apache.velocity.exception.*;
> import org.apache.velocity.context.*;
> import org.apache.velocity.app.*;
> import java.util.ArrayList;
> import java.io.*;
>
> public class ExampleVelocity {
>
> public ExampleVelocity(){
> try{
> Velocity.init();
>
> VelocityContext context = new VelocityContext();
>
> context.put("list",getNames());
>
>
> Template template = null;
>
> try{
> template = Velocity.getTemplate("test.vm");
> }
> catch(ResourceNotFoundException rnf){
> System.out.println(rnf);
> }
> catch(ParseErrorException pee){
> System.out.println(pee);
> }
>
> BufferedWriter writer = new BufferedWriter(new
> OutputStreamWriter(System.out));
>
> if(template != null)
> template.merge(context,writer);
>
> writer.flush();
> writer.close();
>
>
>
> }
> catch(Exception e){
> System.out.println(e);
> }
> }
>
> public ArrayList getNames(){
> ArrayList list = new ArrayList();
> list.add("A");
> list.add("B");
> list.add("C");
> list.add("D");
>
> return list;
>
> }
>
>
> }



--

Ideaxis nv
-facing the internet-

Flanders Multimedia Valley
Wetenschapspark 1
B-3590 DIEPENBEEK

Tel : +32 11 26 89 20
Fax : +32 11 23 22 17
Mobile: +32 497 13 14 81

E-Mail: [EMAIL PROTECTED]
URL: http://www.Ideaxis.com/

Ideaxis nv legal disclaimer
The information contained in this e-mail is confidential and may be privileged. It may 
be read, copied and used only by the intended recipient. If you have received it in 
error, please contact the sender immediately by returning this e-mail. Please delete 
this e-mail and do not disclose its contents to any person. Ideaxis nv does not accept 
liability for any errors, omissions, delays of receipt or viruses in the contents of 
this message which arise as a result of e-mail transmission.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to