Return-Path: Delivered-To: apmail-velocity-general-archive@locus.apache.org Received: (qmail 86464 invoked from network); 28 May 2008 14:20:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 May 2008 14:20:26 -0000 Received: (qmail 19906 invoked by uid 500); 28 May 2008 14:20:28 -0000 Delivered-To: apmail-velocity-general-archive@velocity.apache.org Received: (qmail 19847 invoked by uid 500); 28 May 2008 14:20:28 -0000 Mailing-List: contact general-help@velocity.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: general@velocity.apache.org Delivered-To: mailing list general@velocity.apache.org Delivered-To: moderator for general@velocity.apache.org Received: (qmail 69867 invoked by uid 99); 28 May 2008 08:23:43 -0000 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C8C09C.1061EE46" Subject: Probelm with template X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Wed, 28 May 2008 10:22:00 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Probelm with template Thread-Index: AcjAm+aavSqTIyaeTw+1o0TOW19nEw== From: "Stefan Mutschlechner" To: X-Virus-Checked: Checked by ClamAV on apache.org ------_=_NextPart_001_01C8C09C.1061EE46 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I'm really new by working with velocity, and servelets. I'm able to start function witch uses a template to create a html code. =20 =20 try=20 { /* first, get and initialize an engine */ VelocityEngine ve =3D new VelocityEngine(); //ve.init("C:/Programme/Apache Software Foundation/Tomcat 6.0/webapps/examples/WEB-INF/classes/velocity.properties"); ve.init(); =20 /* next, get the Template */ if(ve.templateExists(strtmp)) { str=3D"Template found !!!!!"; } else { str=3D"Template not found !!!!!"; } Template t =3D ve.getTemplate(strtmp ); /* create a context and add data */ VelocityContext context =3D new VelocityContext(); context.put("name", "World"); /* now render the template into a StringWriter */ =20 t.merge( context, writer ); /* show the World */ // System.out.println( writer.toString() );=20 } catch (Exception e)=20 { System.out.print("Error"+ e+"\n"); } =20 =20 =20 =20 If I have the same source code into a servelet, the servlet don't find the=20 Template. =20 Somebody knows where I can find a small example for this??? I have found more solutions one different websites. I have tried more of this solutions and its not working. =20 Thanks =20 Stefan Mutschlechner ------_=_NextPart_001_01C8C09C.1061EE46--