You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Nathan Rogers <nr...@library.wisc.edu> on 2003/02/25 16:33:25 UTC

Invisible templates

I am trying to work with Velocity to develop a simple web-administration 
application for a database.  I have managed to compile it without any 
errors, have put all the needed jars into WEB-INF/libs and provided a 
placeholder template.

When I load up the URL, nothing displays - but at the same time no 
errors are generated about either not being able to find the template or 
parsing errors.  In fact, there is no log at all.  How can I debug what 
is going wrong so I can make an attempt toward fixing it?

Here is the velocity.properties file I am using
--
# Override some of the default values
file.resource.loader.path = /templates
file.resource.loader.cache = true
file.resource.loader.modificationCheckInterval = 5

runtime.log = /WEB-INF/logs/velocity.log
--
My directory structure is
/webapp/templates
             /WEB-INF/
             /WEB-INF/classes
            /WEB-INF/lib
--





---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Invisible templates

Posted by Dave Newton <da...@solaraccess.com>.
On Thu, 2003-02-27 at 16:55, Lance Lavandowska wrote:
> Dave Newton wrote:
> > I've never assumed that the log files for a web application would be
> > located in the webapp hierarchy, but instead in a /var/log/... or in a
> > /home/user/logs/... directory, as this is where they've almost always
> > been in everything I've worked on.
> Not sure to what degree you can count on this.  

Yeah, I definitely don't... But I've also had enough head-scratchers to
assume that I _will_ have to modify log locations. Lately most of the
things I've been using log to the servlet container's files anyway, so
thankfully I haven't had to deal with it for awhile  :)

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Invisible templates

Posted by Lance Lavandowska <la...@brainopolis.com>.
Dave Newton wrote:
> I've never assumed that the log files for a web application would be
> located in the webapp hierarchy, but instead in a /var/log/... or in a
> /home/user/logs/... directory, as this is where they've almost always
> been in everything I've worked on.
> 
> So add a documentation note or code something up and submit it, no big
> deal, right?

Not sure to what degree you can count on this.  I'm a contributor to 
Roller (http://www.rollerweblogger.org), and an issue that came up for 
one person trying to deploy the app was that the "default" settings 
tried to put the logs at root ("/"), and (correctly) his Tomcat instance 
didn't have permissions to write there.

He solved it by editing the properties file to point to his own personal 
specific location, but indicated in his email to the Roller list that it 
took him some time to track this down as the reason Roller wouldn't deploy.

I mention this only because this is (obviously) an issue for someone 
deploying a webapp written by someone else: it has to be a deployment 
note to edit the properties file and set an appropriate log location.

Lance


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Invisible templates

Posted by Dave Newton <da...@solaraccess.com>.
On Thu, 2003-02-27 at 16:23, Barbara Baughman wrote:
> I'm not familiar with VelocityViewServlet - thought that was for use with
> Struts only.  Anyway, if VelocityViewServlet does what you say, then it
> should be included with the standard distribution of Velocity (it's not in
> 1.3-rc2), and the learning examples for newbies should use this servlet
> instead of VelocityServlet.  Newbies assume, and I think it's a reasonable
> assumption, that open source JAVA classes that are servlets should
> incorporate some intelligence about the open source JAVA API for servlet
> containers.  It is so un-intuitive that the file resource loader and
> velocity log of a servlet should assume their base directory is anything
> other than the base directory for the web application.

I've never assumed that the log files for a web application would be
located in the webapp hierarchy, but instead in a /var/log/... or in a
/home/user/logs/... directory, as this is where they've almost always
been in everything I've worked on.

So add a documentation note or code something up and submit it, no big
deal, right?

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Invisible templates

Posted by Nathan Bubna <na...@esha.com>.
Barbara said:
> I'm not familiar with VelocityViewServlet - thought that was for use with
> Struts only.  Anyway, if VelocityViewServlet does what you say, then it
> should be included with the standard distribution of Velocity (it's not in
> 1.3-rc2), and the learning examples for newbies should use this servlet
> instead of VelocityServlet.

first off, the VelocityViewServlet is most definitely absolutely not *only*
for using Velocity with Struts.  in fact, of the whole velocity-tools
project, only a very few classes actually have anything to do with struts at
this point.

second, if we were to move it into the standard distribution of Velocity,
that would entail moving the whole velocity-tools-view project there.  this
is not going to happen so far as i can see, and i don't think i want it to.

>  Newbies assume, and I think it's a reasonable
> assumption, that open source JAVA classes that are servlets should
> incorporate some intelligence about the open source JAVA API for servlet
> containers.  It is so un-intuitive that the file resource loader and
> velocity log of a servlet should assume their base directory is anything
> other than the base directory for the web application.

again, i agree that the current default behavior of the VelocityServlet is
confusing and less than ideal.  in fact, Geir has talked about moving the
WebappLoader (which does what you desire) from the tools project into the
core for some time now (of course, like everything else here recently, it
hasn't been done).  i presume that were he to do this, it would be
implemented as the default for VelocityServlet.

in the meantime, the VelocityViewServlet is a good (and actively maintained)
alternative.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


RE: Invisible templates

Posted by Cort Schaefer <co...@xmission.com>.
Not that this will effect the Velocity proper group, but NVelocity, the
port to C#, has already moved the web based part to a separate package
(NVelocity.Http).  I think that this helps separate the template engine
from one of it's uses, rendering views for web applications.  Seperating
tools from both also makes sense.

Cort

-----Original Message-----
From: Dave Newton [mailto:dave@solaraccess.com] 
Sent: Thursday, February 27, 2003 3:15 PM
To: Velocity Users List
Subject: RE: Invisible templates

On Thu, 2003-02-27 at 17:07, Tim Colson wrote:
> Hah. Might actually wind up with less confusion if the VelocityServlet
> was pulled out of the Velocity main and into the Tools project. <grin>

Actually, I think that's a Good Idea, because, as you say, a template
engine should, in theory, not have anything to do with anything but
templates.

Anything servlety (including sub-servlety things like struts) belong as
an accessory to the template engine.

Just my $.02 :)

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


RE: Invisible templates

Posted by Dave Newton <da...@solaraccess.com>.
On Thu, 2003-02-27 at 17:07, Tim Colson wrote:
> Hah. Might actually wind up with less confusion if the VelocityServlet
> was pulled out of the Velocity main and into the Tools project. <grin>

Actually, I think that's a Good Idea, because, as you say, a template
engine should, in theory, not have anything to do with anything but
templates.

Anything servlety (including sub-servlety things like struts) belong as
an accessory to the template engine.

Just my $.02 :)

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


moving VelocityServlet? Was: Re: Invisible templates

Posted by Nathan Bubna <na...@esha.com>.
Tim said:
...
> Hah. Might actually wind up with less confusion if the VelocityServlet
> was pulled out of the Velocity main and into the Tools project. <grin>

hmm.  yeah, makes sense to pull the web stuff together.

not sure what the best migration process would be.  perhaps just drop a copy
of the current VelocityServlet in veltools and let the core developers drop
that whenever they feel so inclined.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


RE: Invisible templates

Posted by Tim Colson <tc...@cisco.com>.
> I'm not familiar with VelocityViewServlet - thought that was 
> for use with Struts only.  
FYI: VVS is mostly just a little extension of the VelocityServlet that
automagically ties in a toolbox and can then parse *.vm files in a
web-app - called directly from the URL.

VelocityStruts builds on that with some tools to help access the Struts
object graphs.

> Anyway, if VelocityViewServlet does what you say, then it
> should be included with the standard distribution of Velocity 
Hmmm... certainly worth consideration, but it's a slippery slope IMHO.
Newbies are always asking about the Velocity 'framework' and confusing a
simple template engine with something big like Turbine/Struts/etc.
Adding in even more Servlet specific stuff might just add to the mess,
eh?

Hah. Might actually wind up with less confusion if the VelocityServlet
was pulled out of the Velocity main and into the Tools project. <grin>

> It is so un-intuitive that the file resource loader and
> velocity log of a servlet should assume their base directory 
> is anything other than the base directory for the web application.

Again, slippery. I wouldn't expect a Template Engine to know about
servlet specs, but I agree that a SERVLET should. 

Maybe yanking that VelServlet into Tools really is a good idea. <grin>

Timo


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Invisible templates

Posted by Barbara Baughman <ba...@utdallas.edu>.
I'm not familiar with VelocityViewServlet - thought that was for use with
Struts only.  Anyway, if VelocityViewServlet does what you say, then it
should be included with the standard distribution of Velocity (it's not in
1.3-rc2), and the learning examples for newbies should use this servlet
instead of VelocityServlet.  Newbies assume, and I think it's a reasonable
assumption, that open source JAVA classes that are servlets should
incorporate some intelligence about the open source JAVA API for servlet
containers.  It is so un-intuitive that the file resource loader and
velocity log of a servlet should assume their base directory is anything
other than the base directory for the web application.

Barbara Baughman
X2157

On Thu, 27 Feb 2003, Nathan Bubna wrote:

> Barbara said:
> > I still maintain that the VelocityServlet class should assume it's working
> > within a web API and automatically assume the velocity log and file
> > resource loader paths are relative to the web application.  After all,
> > VelocityServlet is SO unlikely to be used for anything other than a web
> > application servlet.  Anyone who does will know enough about programming
> > to use VelocityEngine instead.
> 
> i think that makes good sense.
> 
> > It causes SO MANY problems for newbies.  How about a VelocityServletAPI
> > class, which does this automatically and would be an alternative for
> > VelocityServlet?
> 
> how about the VelocityViewServlet?
> i'd say it's a pretty user friendly alternative.
> why make another one?
> 
> Nathan Bubna
> nathan@esha.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Invisible templates

Posted by Nathan Bubna <na...@esha.com>.
Barbara said:
> I still maintain that the VelocityServlet class should assume it's working
> within a web API and automatically assume the velocity log and file
> resource loader paths are relative to the web application.  After all,
> VelocityServlet is SO unlikely to be used for anything other than a web
> application servlet.  Anyone who does will know enough about programming
> to use VelocityEngine instead.

i think that makes good sense.

> It causes SO MANY problems for newbies.  How about a VelocityServletAPI
> class, which does this automatically and would be an alternative for
> VelocityServlet?

how about the VelocityViewServlet?
i'd say it's a pretty user friendly alternative.
why make another one?

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Invisible templates

Posted by Barbara Baughman <ba...@utdallas.edu>.
I still maintain that the VelocityServlet class should assume it's working
within a web API and automatically assume the velocity log and file
resource loader paths are relative to the web application.  After all,
VelocityServlet is SO unlikely to be used for anything other than a web
application servlet.  Anyone who does will know enough about programming
to use VelocityEngine instead.

It causes SO MANY problems for newbies.  How about a VelocityServletAPI
class, which does this automatically and would be an alternative for
VelocityServlet?

Barbara Baughman
X2157

On Wed, 26 Feb 2003, Bill Burton wrote:

> Hello,
> 
> Nathan Rogers wrote:
> > Nathan Bubna wrote:
> > 
> >> Nathan Rogers said:
> >>  
> >>
> >>> I am trying to work with Velocity to develop a simple web-administration
> >>> application for a database.  I have managed to compile it without any
> >>> errors, have put all the needed jars into WEB-INF/libs and provided a
> >>> placeholder template.
> >>>
> >>> When I load up the URL, nothing displays - but at the same time no
> >>> errors are generated about either not being able to find the template or
> >>> parsing errors.  In fact, there is no log at all.  How can I debug what
> >>> is going wrong so I can make an attempt toward fixing it?
> >>>
> >>> Here is the velocity.properties file I am using
> >>> -- 
> >>> # Override some of the default values
> >>> file.resource.loader.path = /templates
> 
> The Velocity engine is not aware of web app information (because it's 
> not dependant on the servlet API) so you have to specify the full path.
> 
> >>> file.resource.loader.cache = true
> >>> file.resource.loader.modificationCheckInterval = 5
> >>>
> >>> runtime.log = /WEB-INF/logs/velocity.log
> 
> Same as above.
> 
> VelociyServlet could clearly be smarter about setting default properties 
> to reduce or eliminate configuration.
> 
> As Nathan suggests, check out the Velocity Tools sub project as it 
> solves some of these problems.
> 
> -Bill
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Invisible templates

Posted by Bill Burton <bi...@progress.com>.
Hello,

Nathan Rogers wrote:
> Nathan Bubna wrote:
> 
>> Nathan Rogers said:
>>  
>>
>>> I am trying to work with Velocity to develop a simple web-administration
>>> application for a database.  I have managed to compile it without any
>>> errors, have put all the needed jars into WEB-INF/libs and provided a
>>> placeholder template.
>>>
>>> When I load up the URL, nothing displays - but at the same time no
>>> errors are generated about either not being able to find the template or
>>> parsing errors.  In fact, there is no log at all.  How can I debug what
>>> is going wrong so I can make an attempt toward fixing it?
>>>
>>> Here is the velocity.properties file I am using
>>> -- 
>>> # Override some of the default values
>>> file.resource.loader.path = /templates

The Velocity engine is not aware of web app information (because it's 
not dependant on the servlet API) so you have to specify the full path.

>>> file.resource.loader.cache = true
>>> file.resource.loader.modificationCheckInterval = 5
>>>
>>> runtime.log = /WEB-INF/logs/velocity.log

Same as above.

VelociyServlet could clearly be smarter about setting default properties 
to reduce or eliminate configuration.

As Nathan suggests, check out the Velocity Tools sub project as it 
solves some of these problems.

-Bill


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Invisible templates

Posted by Nathan Bubna <na...@esha.com>.
Leonardo said:
>
> > I highly recommend you check out the jakarta-velocity-tools project.  it
> > already comes with Struts support (no new 1.1 feature support yet
though)
>
> When jakarta-velocity-tools will support new 1.1 feature?
>

it looks like that won't happen until at least after we do a 1.0 release of
velocity-tools.  it may be that somethings will go into a contrib folder
before then though.  but, that's as specific as we can get with regards to
"when."  jakarta projects don't run on deadlines or set timeframes.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


R: Invisible templates

Posted by Leonardo Francalanci <lf...@simtel.it>.
> I highly recommend you check out the jakarta-velocity-tools project.  it
> already comes with Struts support (no new 1.1 feature support yet though)

When jakarta-velocity-tools will support new 1.1 feature?



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Invisible templates

Posted by Nathan Bubna <na...@esha.com>.
Nathan Rogers said:
...
> I am trying to use a subclass of VelocityServlet.  I have tracked down
> the problem somewhat - when I hardcode the location of the templates and
> log file, then it looks in the right place (using /webapps/appname as
> root).  When I set them otherwise, it uses the filesystem's root as its
> base so /webapps/appname/templates do not register and it ends up
> showing just a blank screen.
>
> As far as a framework goes, right now I am just playing with Velocity to
> get a feel for it.  I plan to use it in tandem with Struts since that is
> the framework I have to use for most projects.

I highly recommend you check out the jakarta-velocity-tools project.  it
already comes with Struts support (no new 1.1 feature support yet though)
and several much easier and more useful subclasses of VelocityServlet--the
VelocityViewServlet and VelocityLayoutServlet.  these will make your life
much easier in terms of configuration, populating the context, etc.

here's some good beta documentation
http://crufty.happysearch.com/velocity/tools/docs/

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Invisible templates

Posted by Nathan Rogers <nr...@library.wisc.edu>.
Nathan Bubna wrote:

>Nathan Rogers said:
>  
>
>>I am trying to work with Velocity to develop a simple web-administration
>>application for a database.  I have managed to compile it without any
>>errors, have put all the needed jars into WEB-INF/libs and provided a
>>placeholder template.
>>
>>When I load up the URL, nothing displays - but at the same time no
>>errors are generated about either not being able to find the template or
>>parsing errors.  In fact, there is no log at all.  How can I debug what
>>is going wrong so I can make an attempt toward fixing it?
>>
>>Here is the velocity.properties file I am using
>>--
>># Override some of the default values
>>file.resource.loader.path = /templates
>>file.resource.loader.cache = true
>>file.resource.loader.modificationCheckInterval = 5
>>
>>runtime.log = /WEB-INF/logs/velocity.log
>>--
>>My directory structure is
>>/webapp/templates
>>             /WEB-INF/
>>             /WEB-INF/classes
>>            /WEB-INF/lib
>>--
>>    
>>
>
>what framework are you using?  unless you are using the VelocityView
>framework in the Velocity-Tools subproject, then you should first ask this
>question on that list.  if you are using the VelocityViewServlet and
>friends, then you need to let us know that so we can help you appropriately.
>  
>
I am trying to use a subclass of VelocityServlet.  I have tracked down 
the problem somewhat - when I hardcode the location of the templates and 
log file, then it looks in the right place (using /webapps/appname as 
root).  When I set them otherwise, it uses the filesystem's root as its 
base so /webapps/appname/templates do not register and it ends up 
showing just a blank screen.

As far as a framework goes, right now I am just playing with Velocity to 
get a feel for it.  I plan to use it in tandem with Struts since that is 
the framework I have to use for most projects.


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Invisible templates

Posted by Nathan Bubna <na...@esha.com>.
Nathan Rogers said:
> I am trying to work with Velocity to develop a simple web-administration
> application for a database.  I have managed to compile it without any
> errors, have put all the needed jars into WEB-INF/libs and provided a
> placeholder template.
>
> When I load up the URL, nothing displays - but at the same time no
> errors are generated about either not being able to find the template or
> parsing errors.  In fact, there is no log at all.  How can I debug what
> is going wrong so I can make an attempt toward fixing it?
>
> Here is the velocity.properties file I am using
> --
> # Override some of the default values
> file.resource.loader.path = /templates
> file.resource.loader.cache = true
> file.resource.loader.modificationCheckInterval = 5
>
> runtime.log = /WEB-INF/logs/velocity.log
> --
> My directory structure is
> /webapp/templates
>              /WEB-INF/
>              /WEB-INF/classes
>             /WEB-INF/lib
> --

what framework are you using?  unless you are using the VelocityView
framework in the Velocity-Tools subproject, then you should first ask this
question on that list.  if you are using the VelocityViewServlet and
friends, then you need to let us know that so we can help you appropriately.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org