You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Will Glass-Husain <wg...@forio.com> on 2001/07/14 02:17:56 UTC

Re: velocity & jwaa

Hi,

I thought the discussion on the pros and cons of velocity and jwaa was kind
of interesting, if a little overly personal.

As a note for the Velocity developers, I also had some difficulty setting
the default directory for my templates.  This doesn't seem to be a
fundamental flaw in Velocity, but a usability issue.  I suggest that

(1) The documentation should highlight this issue somewhere up front,
perhaps in a tutorial.  (as every new user must face it).

(2) The getTemplate method should accept an absolute path name as well as
one relative to the file.resource.loader.path.  I'd initially assumed this
was the obvious way getTemplate worked.  (and apparently, Brad).

The fact that I figured it out in 3 hours while Brad Cox took 3 days is
likely due to me being luckier (as opposed to smarter).

As a side note, I'm pretty pleased with the way Velocity is working out in
our app (still under development).  It's a nice way of allowing
non-technical users to upload HTML-like files to our site and instantly see
the results.

However, I like to learn about alternative approaches-- I look forward to
reading more about jwaa on the site mentioned in Brad's email.

Best regards, WILL




Re: velocity & jwaa

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Will Glass-Husain wrote:
> 
> Thanks for the quick response.
> 
> Let me add to my suggestion list that the Geir's comment below be the
> default when you install Velocity.  It would save new users a lot of
> headaches, and still allow experienced users the freedom to do what they
> like.

The problem is that when you want to use velocity quick and dirty, as as
a command line app, you would have to then go through the motions of
figuring out current directory and pasting it on.  You will get it
either way.

I think the solution really is, as you suggested, to do a better job
documenting what is really the most common but potentially the most
complicated use - namely webapps.  And it will be done :0


> 
> Geir:
> > Actually, you can do that if you set the template path for the loader to
> > be the 'root', or the 'C-drive', or whatever...  We don't stop you from
> > doing what you want...
> 
> Best, WILL
> 
> P.S.  Got my first non programmer (Info architect?) to write templates for
> my app this afternoon.  It's a real thrill!

cool!

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

RE: velocity & jwaa

Posted by Will Glass-Husain <wg...@forio.com>.
Thanks for the quick response.

Let me add to my suggestion list that the Geir's comment below be the
default when you install Velocity.  It would save new users a lot of
headaches, and still allow experienced users the freedom to do what they
like.

Geir:
> Actually, you can do that if you set the template path for the loader to
> be the 'root', or the 'C-drive', or whatever...  We don't stop you from
> doing what you want...

Best, WILL

P.S.  Got my first non programmer (Info architect?) to write templates for
my app this afternoon.  It's a real thrill!




Re: velocity & jwaa

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Tal Dayan wrote:
> 
> >
> > > The template is in a file and a file path is a common notation to refer
> > > to files in the OS.
> >
> > Except that templates aren't always in a file.  They can be in a jar and
> > loaded by the classloader in a webapp, or in a database, or even just a
> > String or a stream.
> 
> Yes, and these are very important features of Velocity (we are using the
> classpath
> loader for example) but it is very likely that for most people, the velocity
> 'hello world'
> program will use a simple file and then when this works, they will move to
> more advanced
> configurations and only then they read the manual. ;-)

That's what servlet_example2 is for - the classloader version is "Light
and get away..."  and will work - you can then alter it to be file
based, and as you say, go from there.

Like I said before with regards to the templates - either way, someone
is going to have to do work :)  There is no perfect solution (that I can
see...)

> 
> >
> > The problem is that there is really no such thing as an out-of-the-box
> > configuration - it's a library, so you have to write an application
> > around it.
> 
> Yes, this is exactly what we did, a simple 'main' method that uses the
> Velocity class. However, even a library can have a default configuration
> and behavior.

And it does.  Velocity comes complete with a set of defaults - unlike
other template engines, you don't need to do any configuration to get
going.  One of the choices is that we selected '.' to be the default
directory path for the file resource loader, which is the default
loader.  Of course, if we chose the root of the filesystem (which is
what, by the way, on a windows box???) then we would have someone else
saying that it's too hard because they have to put in the full path to
the template.... I suspect we can't win here.
 
> BTW, Velocity is now integrated in our application and works just great. We
> use
> it to customize email notification message sent by the system and we were
> very
> impressed how easy it was to integrate it, we simply passed few existing
> entity
> beans to it and all the information was immediately available to the
> template.
> Thanks for all the good people that provided this great product.

Excellent.
 
> Tal

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

RE: velocity & jwaa

Posted by Tal Dayan <ta...@zapta.com>.
>
> > The template is in a file and a file path is a common notation to refer
> > to files in the OS.
>
> Except that templates aren't always in a file.  They can be in a jar and
> loaded by the classloader in a webapp, or in a database, or even just a
> String or a stream.

Yes, and these are very important features of Velocity (we are using the
classpath
loader for example) but it is very likely that for most people, the velocity
'hello world'
program will use a simple file and then when this works, they will move to
more advanced
configurations and only then they read the manual. ;-)

>
> The problem is that there is really no such thing as an out-of-the-box
> configuration - it's a library, so you have to write an application
> around it.

Yes, this is exactly what we did, a simple 'main' method that uses the
Velocity class. However, even a library can have a default configuration
and behavior.

BTW, Velocity is now integrated in our application and works just great. We
use
it to customize email notification message sent by the system and we were
very
impressed how easy it was to integrate it, we simply passed few existing
entity
beans to it and all the information was immediately available to the
template.
Thanks for all the good people that provided this great product.

Tal


Re: velocity & jwaa

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Tal Dayan wrote:
> 
> As a naive user that just unzipped the Velocity distribution, I would expect
> Velocity.getTemplate(String name ... ) to treat 'name' (also) as a
> standard file path (both relative or absolute).
> 

I see.

> The template is in a file and a file path is a common notation to refer
> to files in the OS.

Except that templates aren't always in a file.  They can be in a jar and
loaded by the classloader in a webapp, or in a database, or even just a
String or a stream.

I certainly understand your argument, and I think that a compromise
would be making sure that the example apps are foolproof with good
documentation, and the things to watch out for are well documented.

That way a bare newbie can start to play with it w/o much stress. 
That's really the key I think - once you get a handle on it, it's ok,
right?
 
> This does not mean that Velocity should not support other template sources
> or loaders
> but it will be nice to have this as a default behavior in an out-of-the-box
> configuration.

The problem is that there is really no such thing as an out-of-the-box
configuration - it's a library, so you have to write an application
around it.

I think the key is even better examples.

Maybe I will put in another example servlet, where you can specify the
name of the template in the URL, so new users can just drop it into a
webapp and start....
 
> Also, if Velocity does not find a template, a detailed message where it
> looked for it and a
> hint how to configure the search domain will be helpful for newbies like us.

Brad thinks so too :)  We can make the log output better, and note in
the docs a troubleshooting strategy.

geir


-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

RE: velocity & jwaa

Posted by Tal Dayan <ta...@zapta.com>.
As a naive user that just unzipped the Velocity distribution, I would expect
Velocity.getTemplate(String name ... ) to treat 'name' (also) as a
standard file path (both relative or absolute).

The template is in a file and a file path is a common notation to refer
to files in the OS.

This does not mean that Velocity should not support other template sources
or loaders
but it will be nice to have this as a default behavior in an out-of-the-box
configuration.

Also, if Velocity does not find a template, a detailed message where it
looked for it and a
hint how to configure the search domain will be helpful for newbies like us.

Tal

> -----Original Message-----
> From: gmj@mta6.srv.hcvlny.cv.net [mailto:gmj@mta6.srv.hcvlny.cv.net]On
> Behalf Of Geir Magnusson Jr.
> Sent: Friday, July 13, 2001 6:59 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: velocity & jwaa
>
>
> Tal Dayan wrote:
> >
> > > > As a note for the Velocity developers, I also had some
> > > difficulty setting
> > > > the default directory for my templates.  This doesn't seem to be a
> > > > fundamental flaw in Velocity, but a usability issue.  I suggest that
> > > >
> > > > (1) The documentation should highlight this issue somewhere
> up front,
> > > > perhaps in a tutorial.  (as every new user must face it).
> > >
> > > You are right.  To that end, there are two readme's, one in
> each example
> > > directory.  I will make them a part of the formal documentation.
> >
> > We also spent some time on this and as a result, HAD to read
> the documention
> > ;-)
>
> Don't drop that thread - what do you mean?  The README's didn't help?
> what would you like them to have?
>
> --
> Geir Magnusson Jr.                           geirm@optonline.net
> System and Software Consulting
> Developing for the web?  See http://jakarta.apache.org/velocity/
> You have a genius for suggesting things I've come a cropper with!
>


Re: velocity & jwaa

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Tal Dayan wrote:
> 
> > > As a note for the Velocity developers, I also had some
> > difficulty setting
> > > the default directory for my templates.  This doesn't seem to be a
> > > fundamental flaw in Velocity, but a usability issue.  I suggest that
> > >
> > > (1) The documentation should highlight this issue somewhere up front,
> > > perhaps in a tutorial.  (as every new user must face it).
> >
> > You are right.  To that end, there are two readme's, one in each example
> > directory.  I will make them a part of the formal documentation.
> 
> We also spent some time on this and as a result, HAD to read the documention
> ;-)

Don't drop that thread - what do you mean?  The README's didn't help? 
what would you like them to have?

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

RE: velocity & jwaa

Posted by Tal Dayan <ta...@zapta.com>.
> > As a note for the Velocity developers, I also had some
> difficulty setting
> > the default directory for my templates.  This doesn't seem to be a
> > fundamental flaw in Velocity, but a usability issue.  I suggest that
> >
> > (1) The documentation should highlight this issue somewhere up front,
> > perhaps in a tutorial.  (as every new user must face it).
>
> You are right.  To that end, there are two readme's, one in each example
> directory.  I will make them a part of the formal documentation.

We also spent some time on this and as a result, HAD to read the documention
;-)

Tal


Re: velocity & jwaa

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Will Glass-Husain wrote:
> 
> Hi,
> 
> I thought the discussion on the pros and cons of velocity and jwaa was kind
> of interesting, if a little overly personal.
> 
> As a note for the Velocity developers, I also had some difficulty setting
> the default directory for my templates.  This doesn't seem to be a
> fundamental flaw in Velocity, but a usability issue.  I suggest that
> 
> (1) The documentation should highlight this issue somewhere up front,
> perhaps in a tutorial.  (as every new user must face it).

You are right.  To that end, there are two readme's, one in each example
directory.  I will make them a part of the formal documentation.

> 
> (2) The getTemplate method should accept an absolute path name as well as
> one relative to the file.resource.loader.path.  I'd initially assumed this
> was the obvious way getTemplate worked.  (and apparently, Brad).

Actually, you can do that if you set the template path for the loader to
be the 'root', or the 'C-drive', or whatever...  We don't stop you from
doing what you want...

> 
> The fact that I figured it out in 3 hours while Brad Cox took 3 days is
> likely due to me being luckier (as opposed to smarter).

Or really wanting it to work :)

> 
> As a side note, I'm pretty pleased with the way Velocity is working out in
> our app (still under development).  It's a nice way of allowing
> non-technical users to upload HTML-like files to our site and instantly see
> the results.
> 
> However, I like to learn about alternative approaches-- I look forward to
> reading more about jwaa on the site mentioned in Brad's email.

Let us know what you find...
 
> Best regards, WILL

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!