Citat Will Glass-Husain <[EMAIL PROTECTED]>:
> Martin,
>
> If at all possible, use VelocityViewServlet from the Velocity Tools
> project. Although it works similarly It's better supported. (we've
> deprecated VelocityServlet in the latest release).
With the latest release, I asume you mean 1.5 which is still in beta.
But I don't understand how VelocityViewServlet, works similary to
VelocityServlet. Let my try if I understand VelocityViewServlet correct.
1: I don't have a class for each template. Insted I populate a View with
'tool objects' that are always available for all templates to use.
2: My classes don't have to extend VelocityViewServlet
3: How do I take the result of a form submit, and write it to a database. Since
there is no class that is always called for a given page, does it mean that if
I submit a form to RecieveForm, it is the responsible of the RecieveForm.vm to
call a method, which can handle the incomming form data?
4: It seems like there need to be a way to force a tool to be loaded on a give
page, even if not used by the template. I don't vant my authorization to depend
on whenever my SomePage.vm file remember to call the correct method in one of my
tools. A combination of push and pull would be really cool :}
Oh, but that was just me trying to understand the pull method. Not my current
problem. That follow below :}
>
> Having said that, you need to override the loadConfiguration method to
> set Velocity properties.
And once I have overridden the loadConfiguration in my MyGallery class what am I
suposed to do in the overloaded method?
I tried to add
protected java.util.Properties
loadConfiguration(javax.servlet.ServletConfig
arg0) throws java.io.IOException, java.io.FileNotFoundException {
java.util.Properties p=super.loadConfiguration(arg0);
p.setProperty("directive.foreach.counter.initial.value","0");
return p;
}
But it still start counting with 1.
> WILL
>
> On 12/5/06, Martin Tilsted <[EMAIL PROTECTED]> wrote:
> > Some basic information:
> > I am using velocity 1.4 with Tomcat 5.5.17, and all my servlets extend the
> class
> > org.apache.velocity.servlet.VelocityServlet
> >
> > And that part is working fine.
> >
> > But now I am trying to set the directive.foreach.counter.initial.value to 0
> so
> > my loop count begin with 0 insted of 1. And I just can't get it to work.
> >
> > I started with something simple, trying to do a
> >
>
org.apache.velocity.app.Velocity.setProperty("directive.foreach.counter.initial.value","0");
> > in my servlet initialization code. But that had no effect. So I tried
> >
>
Vorg.apache.velocity.app.Velocity.setProperty("directive.foreach.counter.initial.value",new
> > Integer(0));
> >
> > But that did not work either. The value of
> > directive.foreach.counter.initial.value is still 1.
> >
> > Is this because the org.apache.velocity.app.Velocity class is meant to be
> used
> > in stand alone applicatinos only?
> >
> > Well then I tried to make a velocity.properties file.
> > A cut from my web.xml file is
> >
> > <servlet>
> > <init-param>
> > <!-- Should this not be org.apache.velocity.properties -->
> > <param-name>properties</param-name>
> > <param-value>/velocity.properties</param-value>
> > </init-param>
> > <servlet-name>MyGallery</servlet-name>
> > <servlet-class>twgc.MyGallery</servlet-class>
> > </servlet>
> >
> > But it still seems like velocity don't pickup my velocity.properties file.
> All
> > the log say about properties are
> >
> > [info] Default Properties File:
> > org/apache/velocity/runtime/defaults/velocity.properties
> >
> > So no error message, or anything that indicate it have loaded my properties
> > file. So what am I doing wrong?
> >
> > Martin Tilsted
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Forio Business Simulations
>
> Will Glass-Husain
> [EMAIL PROTECTED]
> www.forio.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]