velocity-user@jakarta.apache.org
[Top] [All Lists]

Re: FW: Velocity Struts

Subject: Re: FW: Velocity Struts
From: Shinobu Kawai
Date: Wed, 20 Oct 2004 22:13:15 +0900
Hi Chacko,

> Hi (New user)
Welcome to the wonderful world of Velocity.  :)

> Does VelocityContext work only within the VelocityViewServlet?
Well, VelocityViewServlet is the one the automatically creates it for you.

> My current project is based on Struts framework. I wanted to use Velocity to
> generate some dynamic views.
> On the vm file, I did get access to all request, session, application
> objects. What I want to know is from within an Action class, if I declare a
> VelocityContext object, will this be available for access in the vm file?
Only if you give it to the vm file.

> I did some examples but they were either
> 1. an isolated java file, wherein we had defined the velocity engine & then
> merged the vm & context;
> 2. or a servlet class extending the VelocityViewServlet.
I suggest 2.  Makes life a lot easier.  (Well, maybe not all the time.)

> What I want is to continue to use the Struts Action class & also expose the
> context object from there.
My question is, "Why would you want to do that?".  If there is nothing
wrong with passing the values via request/session/etc., then I would
recommend sticking with VelocityViewServlet.  Nothing changes in the
Struts Actions.  After all, Velocity is only the V part of MVC.  ;)

Best regards,
-- Shinobu Kawai

-- 
Shinobu Kawai <shinobu.kawai@xxxxxxxxx>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: velocity-user-help@xxxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>