You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Jeff Duska <Je...@noaa.gov> on 2002/06/25 23:57:40 UTC

Suggestion in the VelocityViewServlet document...

This just might be me, but I find it a bit confusing to have 
VelocityServlet in the Velocity project then call the 
VelocityViewServlet VelocityServlet.

If you look at th jakarta-velocity-tools/view/docs/velservlet.html file 
you'll see that VelocityServlet is used interchangable with 
VelocityViewServlet. I can't tell, but I think this should all be 
VelocityViewServlet. So, I've attached the two xml files with this 
changed. If this is correct, I think I've attached the correct changed 
files.

Regards,




Jeffrey Duska
IMC
Applications Programmer
jeff.duska@noaa.gov

NCDC
151 Patton Avenue
Suite 468
Asheville, NC 28801
(828)271-4485 Office
(828)273-7441 Cell


Re: Suggestion in the VelocityViewServlet document...

Posted by sean <se...@datamage.net>.
In message <00...@amer.cisco.com>, Tim Colson 
<tc...@cisco.com> writes
>So how about a sexier project name that riffs on JASPER?

Vespa? Or Vesper?

:-)

-- 
Sean Legassick
sean@datamage.net
         Hombre soy, nada humano me puede ser ajeno

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Velocity and Data Access Layer Questions...

Posted by Jeff Duska <Je...@noaa.gov>.
I'm using VelocityServlet project. My goal is to create a several 
Velocity Library Tools that are implement the business objects.

I was using the model suggest by Martin Fowler called Row Data Gateway. 
I tweaked this for the recommendation from Block in Effective Java to 
use static factor instead of a constructor. In my case, I have 
findbyRandomNumber(String rnd).

In my test code I just would have

	PurchasedProduct pp=PurchasedProduct.findbyRandomNumber...

I wanted to have something like this for my template users

	#set ($pp= PurchaseProduct.findyRandomNumber...)

	$pp.isFree

The problem is that this doesn't work with VelocityServlet, because 
there isn't a public construtor. I could change from a factory to a 
method, since the object already exists. What happens when I want to 
create another instance of the object?

I could refactor this into two classes. The business object and another 
object that is the factory. My only concern is that I know have quite a 
few classes.

Right now it does findbyRandomNumber
		
  creates a ProductPurchaseFinder (does all the db stuff)
  uses the ProductPruchaseFinder to create the ProductPurchaseGateway
  ProductPurchase would then have function for the business rules
    using a the private instance of ProductPurchaseGateway to stored the
    data

I use the wrapper on ProductPurchase, because I like to replace my 
database code with something like JDO, Torque or Castor at a later date.
At this point, I would need to create ProductPurchaseFactory to hold the
factory functionality. Does this make sense? I'm worried I've made this 
too confusing. I really do expect to rip out the database code in future 
release.

What are you suggestions?

Regards,

Jeff Duska



	
			




I


data acessand I have created a classes that Tools


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


VelocityViewServlet Project can you overide the Log File?Question (Re: Help Velocity Log file Question....)

Posted by Jeff Duska <Je...@noaa.gov>.
I've been trying to figure why my velocity.properties is not being used. 
I now see this is a "feature" of VelocityViewServlet. It says it set by 
default to the Servlet API. I want to turn this off. I'm at loss at how 
to get this to work.

I'm using the velocity.properties file right from the examples. It just 
isn't working. Please help!

I'm digging into the source code, but I must I'm seeing why this isn't 
working.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Help Velocity Log file Question....

Posted by Gabriel Sidler <si...@teamup.ch>.

Jeff Duska wrote:

> 
> I'm having some trouble with one of the VelocityTools (more on that 
> problem in my next email), so I figure it was time to setup a Velocity 
> only log file. I'm having trouble doing this. I don't see what it wrong.
> 
> I copied the velocity.properties.fileloader file. I renamed it to 
> velocity.properties. I removed the following line, because I didn't need 
> it .
> 
> file.resource.loader.path = templates
> 
> I have the following in my web.xml file
> 
> <init-param>
>      <param-name>properties</param-name>
>       <param-value>/velocity.properties</param-value>
>     </init-param>
>     <init-param>
>       <param-name>toolbox</param-name>
>       <param-value>/WEB-INF/toolbox.xml</param-value>
>    </init-param>
> 
> The velocity.properties file is in my web application's root directory 
> like my velocity files.
> 
> What I've seen, so far :
> 
> 1. Something really weird with the veclocity.properties would keep 
> returning to its previous name of velocity.properties.fileloader.
> 
> 2. I copied the velocity.properties.fileloader to create the 
> veclocity.properties. This worked, but it took three reboots to delete 
> the file.
> 
> I'm assuming that Velocity does not use velocity.properties.fileloader 
> in any way shape or form. This is error is really weird and must be XP 
> related not Tomcat or Velocity related. Do you agree?
> 
> 3. The log file is not being created and the Velocity log information is 
> still being added to the Tomcat logs.
> 
> What am I doing wrong?


Jeff,
If you are using VelocityViewServlet, the logger and the resource loader
cannot be configured in the velocity.properties files. They are currently
hard coded. Look at method initVelocity of
org.apache.velocity.tools.view.servlet.VelocityViewServlet for details.

I agree that this is not the best approach. Logger and resource loader should
only be set to defaults if the user does not configure anything else. Geir
mentioned in the past that he wants to look into this.
For now if you want to change logging or resource loading you have to code.
Write a subclass of VelocityViewServlet and overwrite method initVelocity()
with your preferred initialization.

Gabe


--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Help Velocity Log file Question....

Posted by Jeff Duska <Je...@noaa.gov>.
I'm having some trouble with one of the VelocityTools (more on that 
problem in my next email), so I figure it was time to setup a Velocity 
only log file. I'm having trouble doing this. I don't see what it wrong.

I copied the velocity.properties.fileloader file. I renamed it to 
velocity.properties. I removed the following line, because I didn't need 
it .

file.resource.loader.path = templates

I have the following in my web.xml file

<init-param>
	 <param-name>properties</param-name>
       <param-value>/velocity.properties</param-value>
     </init-param>
     <init-param>
       <param-name>toolbox</param-name>
       <param-value>/WEB-INF/toolbox.xml</param-value>
    </init-param>

The velocity.properties file is in my web application's root directory 
like my velocity files.

What I've seen, so far :

1. Something really weird with the veclocity.properties would keep 
returning to its previous name of velocity.properties.fileloader.

2. I copied the velocity.properties.fileloader to create the 
veclocity.properties. This worked, but it took three reboots to delete 
the file.

I'm assuming that Velocity does not use velocity.properties.fileloader 
in any way shape or form. This is error is really weird and must be XP 
related not Tomcat or Velocity related. Do you agree?

3. The log file is not being created and the Velocity log information is 
still being added to the Tomcat logs.

What am I doing wrong?

Regards,

Jeff


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Suggestion in the VelocityViewServlet document...

Posted by Gabriel Sidler <si...@teamup.ch>.
Tim Colson wrote:

> Jeff has a good point, having been around awhile I still get tripped up
> by the project/class names. ;-)
> 
> Besides, "VelocityServlet Project" is boring compared to "Texen" or
> "Anakia!" <grin>
> 
> When explaining VelocityServlet, I say, "The goal is to make *.vm a
> drop-in replacement for *.jsp, but without the pain of JSP."
> 
> I continue saying it compares to "Jasper.jar" but instead of parsing
> java scriptlets and taglibs, it parses Velocity directives.
> 
> So how about a sexier project name that riffs on JASPER? 
> 
> (I had to look up jasper -  it is a form of green quartz, or
> chalcedony.)
> http://mineral.galleries.com:/minerals/SILICATE/QUARTZ/quartz.htm
>   "Cryptocrystalline (crystals too small to be seen even by a
> microscope) varieties are also used as semi-precious stones and for
> ornamental purposes. These varieties are divided more by character than
> by color. Chalcedony or agate is divided into innumeral types that have
> been named for locally common varieties. Some of the more beautiful
> types have retained their names on a world-wide basis while other names
> have faded into obscurity.
> 
> 
> How about calling the project "AMETHYST" or "TOPAZ" (other types of
> quartz)?
> Or, a different relationship 'sounds similar but better', call it
> "LUSTER" ? :-)


I am for a name change if people feel that this will help to avoid
confusion.

The history is that initially the name of the subproject was VelServlet.
Several people felt that we should use 'Velocity' as part of the name to
make the connection to the Velocity project. As a consequence, the name
was changed to VelocityServlet.

How about:
- VelocityViews

Or a riff on Jasper:
- Casper

Topaz is nice if we want to go with a fantasy name.

My preferred choice at the moment is VelocityViews: It avoids the confusion
with exising class names, it's unique, it's easy to remeber, it makes the
connection to Velocity.


More opinions?


Gabe






--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Suggestion in the VelocityViewServlet document...

Posted by Tim Colson <tc...@cisco.com>.
Jeff has a good point, having been around awhile I still get tripped up
by the project/class names. ;-)

Besides, "VelocityServlet Project" is boring compared to "Texen" or
"Anakia!" <grin>

When explaining VelocityServlet, I say, "The goal is to make *.vm a
drop-in replacement for *.jsp, but without the pain of JSP."

I continue saying it compares to "Jasper.jar" but instead of parsing
java scriptlets and taglibs, it parses Velocity directives.

So how about a sexier project name that riffs on JASPER? 

(I had to look up jasper -  it is a form of green quartz, or
chalcedony.)
http://mineral.galleries.com:/minerals/SILICATE/QUARTZ/quartz.htm
  "Cryptocrystalline (crystals too small to be seen even by a
microscope) varieties are also used as semi-precious stones and for
ornamental purposes. These varieties are divided more by character than
by color. Chalcedony or agate is divided into innumeral types that have
been named for locally common varieties. Some of the more beautiful
types have retained their names on a world-wide basis while other names
have faded into obscurity.


How about calling the project "AMETHYST" or "TOPAZ" (other types of
quartz)?
Or, a different relationship 'sounds similar but better', call it
"LUSTER" ? :-)

By the by - the Struts tools stuff is working marvelously for me right
now - way to go Gabe!

Tim
P.S. A more unique name also helps for searches, try googling "texen"
and it's top of the list. Try to find "JSP sucks I want Velocity
instead", the VelocityServlet sub-project doesn't show up, but curiously
a few posts by Jon S. do <grin>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Suggestion in the VelocityViewServlet document...

Posted by Jeff Duska <Je...@noaa.gov>.
It might be just me but I find it confusing at first that there is a 
VelocityServlet in Velocity. As I've mentioned, I am just picking up 
Velocity. But my understanding is that most developer should take 
advantage of VelocityServlet in their project. They would create 
MyVelocityServlet by inheriting from VelocityServlet class.

I started use Velocity from the VelocityServlet project, so maybe this 
is why I see this a bit confusing. Yesterday, I was looking over the 
stack trace to learn what I was doing wrong. I saw VelocityServlet. I 
thought ok. I'll go look for that in the VelocityServlet project. Well, 
surprise that not part of the VelocityServlet sub-project that is part 
of Velocity project.

As Velocity and VelocityServlet project popular grows, it could get 
confusing to what people are referring to. Did he mean the 
VelocityServlet class or the VelocityServlet subproject?  I just figure 
that if I pause for a moment to think about this. I assume the next 
programmer after me is will do the same thing.

I'll always suggest eliminating any possible ambiguity no matter how 
remote the possible of it occurring.

That's my two cents worth take for what its worth.

Regards,

Jeff


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Suggestion in the VelocityViewServlet document...

Posted by Gabriel Sidler <si...@teamup.ch>.
Jeff Duska wrote:

> This just might be me, but I find it a bit confusing to have 
> VelocityServlet in the Velocity project then call the 
> VelocityViewServlet VelocityServlet.
> 
> If you look at th jakarta-velocity-tools/view/docs/velservlet.html file 
> you'll see that VelocityServlet is used interchangable with 
> VelocityViewServlet. I can't tell, but I think this should all be 
> VelocityViewServlet. So, I've attached the two xml files with this 
> changed. If this is correct, I think I've attached the correct changed 
> files.


Jeff,
in the documentation "VelocityServlet" is the name of the subproject. It does
not refer to class org.apache.velocity.servlet.VelocityServlet.

The first paragraphs of the documentation explain it this way:
"VelocityServlet is a subproject of Velocity. ..."

   and a bit later

"VelocityServlet provides a standalone Java servlet that renders
Velocity templates. Its class name is VelocityViewServlet. It can
be invoked either directly from Web clients or from other servlet by
forwarding requests for template rendering to it. Its usage is similar
to the JSPServlet for rendering JSP pages."


Isn't this clear enough? The changes you propose make the class name
the project name. I am not convinced by that approach.

I realize just now however, that the documentation is misleading at places. For
example in the overview page it says: "VelocityServlet is a standalone
servlet that can be used for template rendering in Web applications...".
This is obviously misleading. I will go over the doc and make sure
that VelocityServlet is used consistently as the project name and
VelocityViewServlet as the class name. Satisfied?

Thanks for the feedback!


Gabe



> 
> Regards,
> 
> 
> 
> 
> Jeffrey Duska
> IMC
> Applications Programmer
> jeff.duska@noaa.gov
> 
> NCDC
> 151 Patton Avenue
> Suite 468
> Asheville, NC 28801
> (828)271-4485 Office
> (828)273-7441 Cell
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0"?>
> 
> <document>
> 
>  <properties>
>   <title>Velocity View For Struts</title>
>   <author email="sidler@apache.org">Gabriel Sidler</author>
>   <author email="geirm@apache.org">Geir Magnusson Jr.</author>
>   <projectfile>xdocs/velservlet-menue.xml</projectfile>
>  </properties>
> 
>  <body>
>  
>  <section name="Welcome to VelocityViewServlet">
> 
>     <p>VelocityViewServlet is a subproject of Velocity. Its goals is to create a 
>     standalone Velocity servlet that can be used for template rendering 
>     in Web applications.</p>
>     <p>Intended audience of this subproject are Web
>     application developers that plan on adding Velocity as a view layer
>     technology to their Servlet-based web application framework. VelocityViewServlet 
>     offers the following key features:</p>
>     
>     <ul>
>         <li>VelocityViewServlet provides is a standalone Java servlet that renders Velocity 
>             templates. Its class name is VelocityViewServlet.
>             It can be invoked either directly from Web clients or from other servlets
>             by forwarding request for template rendering to it. Its usage is
>             similar to the JSPServlet for rendering JSP pages.</li>
>         <li>VelocityViewServlet makes ServletRequest attributes, HttpSession attributes and 
>             ServletContext attributes automatically available to the template designer 
>             through the Velocity context. It is not necessary to explicitely
>             populate the Velocity context.</li>
>         <li>VelocityViewServlet offers toolbox support. It is possible to define a set
>             of view tools (view helpers) that are made available to the template
>             designer automatically through the Velcity context.</li>
>         <li>Velocity log output can be redirected to the log infrastructure 
>             of the Web application. By default, the log is directed to the
>             logging facility provided by the Servlet API.</li>
>     </ul>
>        
>     <p>Using VelocityViewServlet, it becomes possible to write Web applications that are 
>     independent of a particular view technology. This opens a straightforward
>     migration path between JSP pages and Velocity templates as the view layer
>     technology in Web applications.</p>
> 
>     <p>A typical application case for VelocityViewServlet is to use it in conjunction
>     with a Servlet-based web application framework. 
>     <a href="../../struts/docs/index.html">VelocityStruts</a> is a Velocity
>     subproject that brings Velocity to the Struts world and is the first 
>     application that takes advantage of VelocityViewServlet.</p>
> 
> 
>     <p><strong>To be added</strong></p>
>     <ul>
>         <li>Examples</li>
>         <li>Configuration of Servlet</li>
>         <li>Configuration of Toolbox</li>
>         <li>Download</li>
>         <li><a href="javadoc-velservlet/index.html">Javadoc</a></li>
>     </ul>
>   </section>
>  
>  </body>
> </document>
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0"?>
> 
> <project href="http://jakarta.apache.org/velocity/">
> 
>   <title>VelocityServlet Menue</title>
>   <logo href="http://jakarta.apache.org/velocity/images/logo.gif">&lt;  :)  /&gt;</logo>
> 
>   <body>
> 
>     <uplink name="Velocity Tools Home"        href="../../docs/index.html" alt="top"/>
> 
>     <menu name="About VelocityViewServlet">
>         <item name="Overview"                 href="velservlet.html"/>
>         <item name="Examples"/>
>         <item name="Servlet Configuration"/>
>         <item name="Toolbox Configuration"/>
>         <item name="Download"/>
>         <item name="Javadoc"                  href="javadoc-velservlet/index.html"/>
>     </menu>
> 
>     <printerversion/>
> 
>   </body>
> </project>
> 
> 
> 
> ------------------------------------------------------------------------
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


-- 
--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>