You might find more help on the [EMAIL PROTECTED] list.  This
list doesn't have a lot of subscribers, i think.

Anyway, if you are working with Velocity in a servlet environment, you
should really be using VelocityTools as well.
http://velocity.apache.org/tools/devel/

VelocityTools provides the VelocityViewServlet and other support
classes like the WebappResourceLoader (formerly known as the
WebappLoader), which is probably what you need most right now.
Loading templates reliably in a servlet environment using the default
FileResourceLoader.  For info on how to do that, check the website,
the examples that come with the VelocityTools distribution, and of
course, search the mailing list archives
(http://velocity.markmail.org)

On Wed, May 28, 2008 at 1:22 AM, Stefan Mutschlechner
<[EMAIL PROTECTED]> wrote:
>
> 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.
>
>
>
>
>
> try
>
>      {
>
>              /*  first, get and initialize an engine  */
>
>              VelocityEngine ve = new VelocityEngine();
>
>              //ve.init("C:/Programme/Apache Software Foundation/Tomcat
> 6.0/webapps/examples/WEB-INF/classes/velocity.properties");
>
>              ve.init();
>
>              /*  next, get the Template  */
>
>              if(ve.templateExists(strtmp))
>
>              {
>
>                  str="Template found !!!!!";
>
>              }
>
>              else
>
>              {
>
>                  str="Template not  found !!!!!";
>
>              }
>
>              Template t = ve.getTemplate(strtmp );
>
>              /*  create a context and add data */
>
>              VelocityContext context = new VelocityContext();
>
>              context.put("name", "World");
>
>              /* now render the template into a StringWriter */
>
>
>
>              t.merge( context, writer );
>
>              /* show the World */
>
>             // System.out.println( writer.toString() );
>
>      }
>
>        catch (Exception e)
>
>          {
>
>            System.out.print("Error"+ e+"\n");
>
>          }
>
>
>
>
>
>
>
>
>
> If I have the same source code into a servelet, the servlet don't find
> the
>
> Template.
>
>
>
> 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.
>
>
>
> Thanks
>
>
>
> Stefan Mutschlechner
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to