velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nbu...@gmail.com>
Subject Re: Struts and I18N
Date Thu, 25 Aug 2005 21:07:24 GMT
On 8/25/05, Neal Smith <Neal.Smith@sas.com> wrote:
> Oi?  That's not very nice...  I was having a very hard time interpreting that last "sentence"
from the previous email.

"oi" isn't nice?  sorry, i was just trying to express that my brain
was taxed trying to figure out what needed explaining here.  the
question about the VVS being held by the request didn't make sense (at
least not to me).  so then i just explained the basics to make sure
we're on the same page there.  anyway, i really don't mean to not be
very nice.  trying to help here...

as for my last sentence, i suppose i could rephrase it to say that
full toolbox support (the "standalone" stuff) is more work than just
hacking the MessageTool, but it is also a more flexible solution and
may be worth the extra effort in the long run.
 
> I completely understand how it works in the normal servlet context.  You have to admit
there is a lack of good doc on using this "standalone" as you put it.

there's not really any doc on it, so far as i know.  that's one of the
reasons that it'll be more work.

> I appreciate the pointers on where to look.  If I go ahead and do the hack, then I might
as well pull Velocity out altogether.  I was leaning towards that before I decided to give
it one more try.  Hopefully, these resources will have the answer.

if your dependence on Velocity is that light, then you probably
wouldn't find standalone toolbox support to be worth the effort.  i
would recommend that you just create your own MessageTool either by
mimicking, hacking, and/or extending the VelocityTools one.
 
> 
> Thanks,
> Neal
> 
> 
> -----Original Message-----
> From: Nathan Bubna [mailto:nbubna@gmail.com]
> Sent: Thursday, August 25, 2005 3:14 PM
> To: Velocity Users List
> Subject: Re: Struts and I18N
> 
> On 8/25/05, Neal Smith <Neal.Smith@sas.com> wrote:
> > Re: Formatting Numbers, etc. -  I had read that, but being so wrapped up in Struts
stuff, I completely forgot about that.
> >
> > Re: VelocityContext - Hmmm...  This is where I thought I was going to have an issue.
 The existing code is just creating a new VelocityContext.  I'm not sure I understand all
of your last question.  I see by the doc, that VelocityViewServlet has a protected createContext(),
but how do I get hold of that context?  Is the request holding the VelocityViewServlet for
me or do I need to create my own?
> 
> oi...  well, servlets exist to handle servlet requests.  requests don't hold servlets.
 :)  whether or not a servlet handles a particular request depends on the webapp configuration
in your web.xml file.  typically, the VVS (VelocityViewServlet) will only handle a request
if it is a request for a velocity template.  (Tim Colson made a nice graphic illustration
of this for our VelocityStruts docs-- http://jakarta.apache.org/velocity/tools/struts/).
> 
> when the VVS gets a request, it creates a special ChainedContext for it and attaches
a "toolbox".  The contents of the toolbox are determined by your toolbox.xml file (your web.xml
should tell the VVS where this file is).
> 
> so, all this is to say...  it doesn't seem likely that the VVS is getting involved with
the HTTP request that is creating these emails.
> i'm really not at all sure the best way to make that happen.  so it's hard to say where
to go from here.  if you search the archives for "standalone toolbox" or look into the ServletToolboxManager
class
> (http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/view/servlet/ServletToolboxManager.html)
> you may be able to create an appropriate context for your emails that could include an
initialized MessageTool.
> 
> or, you may just want to hack the MessgeTool to make it so that you can manually hand
it the locale and resource bundle and place it in your simple context.  this might be the
easiest way to go for now.
> however, in the long run, the flexibility of full toolbox support might be worth it.
> 
> > Thanks,
> > Neal
> >
> > P.S.  Here is the code where we create the VelocityContext:
> #snip
> 
> yeah, that's just creating a basic empty context.  no special VelocityTools powers. :)
> 
> ---------------------------------------------------------------------
> 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
> 
>

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


Mime
View raw message