Re: Initializing Velocity ouside of a servlet

2005-06-28 Thread Markos Charatzas
Hello Leo,

For starters, try and initialize velocity with a Properties object loaded 
using a Resource. Make sure that velocity.properties is in the classpath.

e.g.

InputStream vProps = 
this.getClass().getResourceAsStream(/velocity.properties);

try {
Properties properties = new Properties();   
properties.load(vProps);
VelocityEngine velocityEngine = new VelocityEngine();
velocityEngine.init(properties);
VelocityContext context = new VelocityContext();
}
catch(Exception e) {
logger.error(velocity engine failed to initialise, e);
}   


Also, in velocity.properties you have to specify the template loader to use. 
(have a look here for template loaders, 
http://jakarta.apache.org/velocity/developer-guide.html#Configuring%20Resource%20Loaders)

Try ClasspathLoader
--
resource.loader = production

production.loader.description = Production Resource Loader
production.resource.loader.class = 
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
--

When using velocityEngine.getTemplate(String) just make sure that the path is 
in the following format

templates/myTemplate.vm


and that templates/ dir is in the classpath since you are using a 
ClasspathResourceLoader

Regards,
Markos

On Tuesday 28 June 2005 09:06, Leo Asanov wrote:
 Hi!

 What is the right way to initialize Velocity outside
 of a servlet? My application works fine when I'm using
 VelocityViewServlet, but when I'm trying to initialize
 Velocity from any standard Java class (with
 Velocity.init(absolutePathToPropertiesFile))
 Velocity.mergeTemplate always throws
 ResourceNotFound exception.

 I guess this happens because Velocity cannot get
 parent directory of a web application without a
 reference to servlet context. But I'm not sure what I
 can do with this. I can't specify absolute path in
 velocity.properties and I would prefer to avoid
 setting path properties directly in the code (I don't
 know how to it anyway - tried
 Velocity.setProperty(file.resource.loader.path,absolutePathToTemplateDire
ctory) and it didn't work).
 Maybe it's possible to pass a default directory path
 somehow?

 Cheers,
 Leo Asanov



 
 Yahoo! Sports
 Rekindle the Rivalries. Sign up for Fantasy Football
 http://football.fantasysports.yahoo.com

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Standalone Application Toolbox

2005-06-21 Thread Markos Charatzas
Hi there,

It is possible to have a toolbox in a standalone velocity application?

Thanks in advance,
Markos

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Standalone Application Toolbox

2005-06-21 Thread Markos Charatzas
Im using the org.apache.velocity.tools.view.XMLToolboxManager to load the 
toolbox, but do I need to register it somehow with the VelocityEngine?

Thanks,
Markos

On Tuesday 21 June 2005 14:29, Markos Charatzas wrote:
 Hi there,

 It is possible to have a toolbox in a standalone velocity application?

 Thanks in advance,
 Markos

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Standalone Application Toolbox

2005-06-21 Thread Markos Charatzas
Digging around I found out that I just jave to use the context provided by 

toolboxManager.getToolboxContext(String)

instead. Although I must be missing something cuz using is it seems that the 

template.merge( Context context, Writer writer )

does not actually work its way through the #foreach directive...

Thanks,
Markos


On Tuesday 21 June 2005 14:58, Markos Charatzas wrote:
 Im using the org.apache.velocity.tools.view.XMLToolboxManager to load the
 toolbox, but do I need to register it somehow with the VelocityEngine?

 Thanks,
 Markos

 On Tuesday 21 June 2005 14:29, Markos Charatzas wrote:
  Hi there,
 
  It is possible to have a toolbox in a standalone velocity application?
 
  Thanks in advance,
  Markos
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Standalone Application Toolbox

2005-06-21 Thread Markos Charatzas
Just used the new VelocityContext(Context context) constructor to wrap the 
toolbox context.

Hope someone will find this thread useful! :p

Sorry for the trouble,
Markos

On Tuesday 21 June 2005 15:21, Markos Charatzas wrote:
 Digging around I found out that I just jave to use the context provided by

 toolboxManager.getToolboxContext(String)

 instead. Although I must be missing something cuz using is it seems that
 the

 template.merge( Context context, Writer writer )

 does not actually work its way through the #foreach directive...

 Thanks,
 Markos

 On Tuesday 21 June 2005 14:58, Markos Charatzas wrote:
  Im using the org.apache.velocity.tools.view.XMLToolboxManager to load the
  toolbox, but do I need to register it somehow with the VelocityEngine?
 
  Thanks,
  Markos
 
  On Tuesday 21 June 2005 14:29, Markos Charatzas wrote:
   Hi there,
  
   It is possible to have a toolbox in a standalone velocity application?
  
   Thanks in advance,
   Markos
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Encoding Problem

2005-05-03 Thread Markos Charatzas
In velocity.properties use

input.encoding=ISO-8859-7 or UTF-8, depending on the encoding of the 
templates.

Regards,
Markos

On Tuesday 03 May 2005 10:26, Sandeep kamath wrote:
 Hi,
   I am quite new to Velocity. My requirement is that I need to process a
 template that has greek characters in it. The current encoding used in
 my Java code is UTF-8 which doesn't work.

 Has anyone used Velocity for Greek and is yes, whats the encoding that
 needs to be used?

 Regards,
 Sandeep

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 03, 2005 12:54 PM
 To: Sandeep kamath
 Subject: WELCOME to velocity-user@jakarta.apache.org

 Hi! This is the ezmlm program. I'm managing the
 velocity-user@jakarta.apache.org mailing list.

 I'm working for my owner, who can be reached
 at [EMAIL PROTECTED]

 Acknowledgment: I have added the address

[EMAIL PROTECTED]

 to the velocity-user mailing list.

 Welcome to [EMAIL PROTECTED]

 Please save this message so that you know the address you are
 subscribed under, in case you later want to unsubscribe or change your
 subscription address.


 --- Administrative commands for the velocity-user list ---

 I can handle administrative requests automatically. Please
 do not send them to the list address! Instead, send
 your message to the correct command address:

 To subscribe to the list, send a message to:
[EMAIL PROTECTED]

 To remove your address from the list, send a message to:
[EMAIL PROTECTED]

 Send mail to the following for info and FAQ for this list:
[EMAIL PROTECTED]
[EMAIL PROTECTED]

 Similar addresses exist for the digest list:
[EMAIL PROTECTED]
[EMAIL PROTECTED]

 To get messages 123 through 145 (a maximum of 100 per request), mail:
[EMAIL PROTECTED]

 To get an index with subject and author for messages 123-456 , mail:
[EMAIL PROTECTED]

 They are always returned as sets of 100, max 2000 per request,
 so you'll actually get 100-499.

 To receive all messages with the same subject as message 12345,
 send an empty message to:
[EMAIL PROTECTED]

 The messages do not really need to be empty, but I will ignore
 their content. Only the ADDRESS you send to is important.

 You can start a subscription for an alternate address,
 for example [EMAIL PROTECTED], just add a hyphen and your
 address (with '=' instead of '@') after the command word:
 [EMAIL PROTECTED]

 To stop subscription for this address, mail:
 [EMAIL PROTECTED]

 In both cases, I'll send a confirmation message to that address. When
 you receive it, simply reply to it to complete your subscription.

 If despite following these instructions, you do not get the
 desired results, please contact my owner at
 [EMAIL PROTECTED] Please be patient, my owner is a
 lot slower than I am ;-)

 --- Enclosed is a copy of the request I received.

 Return-Path: [EMAIL PROTECTED]
 Received: (qmail 21090 invoked by uid 99); 3 May 2005 07:23:42 -
 X-ASF-Spam-Status: No, hits=0.0 required=10.0
   tests=
 X-Spam-Check-By: apache.org
 Received-SPF: pass (hermes.apache.org: local policy)
 Received: from 12-107-29-10.sapient.com (HELO sapient.com)
 (12.107.29.10)
   by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 03 May 2005 00:23:42
 -0700
 Received: from lonmail1.sapient.com ([10.225.1.7]) by sapient.com with
 Microsoft SMTPSVC(6.0.3790.211);
Tue, 3 May 2005 00:22:02 -0700
 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
 Content-class: urn:content-classes:message
 MIME-Version: 1.0
 Content-Type: text/plain;
   charset=us-ascii
 Content-Transfer-Encoding: quoted-printable
 Subject: RE: confirm subscribe to velocity-user@jakarta.apache.org
 Date: Tue, 3 May 2005 08:21:55 +0100
 Message-ID:
 [EMAIL PROTECTED]
 X-MS-Has-Attach:
 X-MS-TNEF-Correlator:
 Thread-Topic: confirm subscribe to velocity-user@jakarta.apache.org
 Thread-Index: AcVPsK85ZrMv1t7OTIqb/NOgdNLEHwAABfXA
 From: Sandeep kamath [EMAIL PROTECTED]
 To:
 [EMAIL PROTECTED]
 karta.apache.org
 Return-Path: [EMAIL PROTECTED]
 X-OriginalArrivalTime: 03 May 2005 07:22:02.0725 (UTC)
 FILETIME=[CD4EA950:01C54FB0]
 X-Virus-Checked: Checked



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 03, 2005 12:52 PM
 To: Sandeep kamath
 Subject: confirm subscribe to velocity-user@jakarta.apache.org

 Hi! This is the ezmlm program. I'm managing the
 velocity-user@jakarta.apache.org mailing list.

 I'm working for my owner, who can be reached
 at [EMAIL PROTECTED]

 To confirm that you would like

[EMAIL PROTECTED]

 added to the velocity-user mailing list, please send
 an empty reply to this address:

 =20
 [EMAIL PROTECTED]
 a=
 k
 arta.apache.org

 Usually, this happens when you just hit the reply button.
 If this does not work, simply copy the address and paste it into
 the To: field of a new message.

 or click here:
 =09
 mailto:velocity-user-sc.1115104944.dbodddpckjgdmajhhjcg-skamath=3Dsapien
 t=
 .
 [EMAIL PROTECTED]

 

Re: Velocity and JDBC

2005-02-23 Thread Markos Charatzas
Hm...

Im quite skeptical about this...

Why not use a proper OR mapping tool (e.g. hibernate), provide a complete db 
implementation (Database, DatabaseRequest, DatabaseClient) and then use a db 
client wrapper to place as a tool using the velocity toolbox.

Regards,
Markos

On Wednesday 23 February 2005 08:10, Manish wrote:
  What would be the best approach to display DB results on page.

 I'd check out Claude's project, Velosurf.
 http://velosurf.sourceforge.net/


 Thanks for the link!! :)
 Is it feasible to use velosurf with Struts/Velocity paradigm.
 Some design restrictions require me to use action for every link on web
 page so that it passes through the custom request processor that we have.
 So need to know about this feasibility before I look into more details. Any
 inputs will be highly appreciated.

 TIA,
 - Manish




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Velocity and JDBC

2005-02-23 Thread Markos Charatzas
Well ofcourse it depends on the scale of the application.

If you want something quick and dirty you can do it with Velosurf no probs.

I was just trying to alert ppl who might jump straight to the Velosurf wagon 
to support their database driven application.

Markos

On Wednesday 23 February 2005 14:51, Claude Brisson wrote:
 On Wed, 2005-02-23 at 12:39 +0200, Markos Charatzas wrote:
  Hm...
 
  Im quite skeptical about this...
 
  Why not use a proper OR mapping tool (e.g. hibernate), provide a
  complete db implementation (Database, DatabaseRequest, DatabaseClient)
  and then use a db client wrapper to place as a tool using the velocity
  toolbox.

 What do you mean by proper? bigger? ;-)
 do you really mean that hibernate + a wrapper tool would be a proper
 solution?

 just curious...

 Claude




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat 4.1.31 and velocity - template location problem

2005-02-21 Thread Markos Charatzas
Hello Michael,

In a servlet environment I would recommed that you use a 
org.apache.velocity.tools.view.servlet.WebappLoader

with the loader.path specified as you have it already.

Have a good week :)
Markos

On Sunday 20 February 2005 19:57, Michael Salmon wrote:
 Just a follow-up. I found that from where I launch tomcat is where it
 wants to load templates from. It seems clear to me my loader.path is not
 being setup correctly. For now until I have a better solution I'll just
 have to launch tomcat from my webapp root and put my templates there..
 Still I'd love to have a proper solution.

 thanks
 Michael

 On Sun, Feb 20, 2005 at 09:46:47AM -0800, Michael Salmon wrote:
  hi folks
 
  I'm trying to get my development environment setup on freebsd and
  templates don't load from where I want. In particular here is what
  I'm doing:
 
  1. servlet extends VelocityServlet. and calls Velocity.init(). I dont
  override loadConfiguration()
 
  2. In my webapp, web.xml I define the specific properties file:
  param-nameorg.apache.velocity.properties/param-name
  param-value/WEB-INF/velocity.properties/param-value
 
  I'm pretty sure the right velocity.properties file is being loaded,
  because when I change the name it spits an error in the log.
 
  4. In the properties file I define:
 
  file.resource.loader.path = /WEB-INF/templates/
 
  5. In my servlet I do:
  getTemplate(Test.vm);
 
  /www/element/WEB-INF/templates/Test.vm - this file exists
 
  6. catalina.log -
  org.apache.velocity.exception.ResourceNotFoundException: Unable to find
  resource 'Test.vm'
 
 
  7. If I copy my template to /www/element/Test.vm velocity finds the
  template, but I'd prefer not to keep my templates there. So any
  suggestion to make it load from the location I want but obvoiusly am
  setup wrong?
 
  Thanks,
  Michael

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Application Resources and TextTool

2005-02-11 Thread Markos Charatzas
On Thursday 10 February 2005 17:50, Nathan Bubna wrote:
 i only rarely put things directly into the
 request myself.  i mostly use tools to access my request scoped data.
 those are easy enough to keep track of in my toolbox.xml file.

So how do u go on about data that you want to make available to Velocity? You 
have to call request.setAttribute()


 but here's an off-the-top-of-my-head suggestion you could do to help
 avoid namespace collisions like this:  use different naming
 schemes/prefixes for different parts of your application.  for
 instance, you could prefix all your resource bundle keys with rb_
 or something like tha

Yeah, that's what I did in the end!
Thanks for your support Nathan.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Charset (Struts and Velocity)

2005-02-11 Thread Markos Charatzas
On Friday 11 February 2005 07:21, Shinobu Kawai wrote:
 resource files and charset might be your problem.  Do you mean
 your resource files have non-ascii characters in it?  If so, that's
 your problem.  They must be escaped java-wise like \u1234.
 cf.
 http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding


Yes, they actually have Greek character so I have saved them in ISO-8859-7

Ok here is what I've done.
I removed the contentType declaration in struts-config.xml
Now, in velocity.properties *if* i put either 

output.encoding=ISO-8859-7
or
default.contentType=text/html; charset=ISO-8859-7

then all data coming from the resource bundles isnt displayed properly ()

if I remove either declaration in velocity.properties then the data displays 
correctly *but* all data (encoded in ISO-8859-7) made available to velocity 
via the request.setAttribute(String, Object) is displayed as ???. 

:S

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Charset (Struts and Velocity)

2005-02-11 Thread Markos Charatzas
Just to point out that the data stored in the DB is using cp-1253 :/

So far I didnt have to deal with ResourceBundles so all text was inside the 
HTML templates.

I cant seem to understand why setting the output encoding in 
velocity.properties to ISO-8859-7 would cause the data coming from the 
ResourceBundles not to display properly since *its encoded* in that same 
charset :/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Charset (Struts and Velocity)

2005-02-11 Thread Markos Charatzas
On Friday 11 February 2005 07:21, Shinobu Kawai wrote:
They must be escaped java-wise like \u1234.

Shinobu I did that and it worked. Thanks.

Although I find it a bit hard to accept that any resource bundle must be in 
that format. That makes life a bit harder :/

Still I cannot understand why setting the output.encoding to ISO-8859-7 in 
velocity.properties has that effect I mentioned earlier. 

Even more since you pointed out that the output.encoding doesn't matter unless 
you're using VelocityServlet or Anakia and Im using VelocityViewServlet

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Charset (Struts and Velocity)

2005-02-11 Thread Markos Charatzas
On Friday 11 February 2005 17:45, Shinobu Kawai wrote:
 It's all Java stuff.  Java stores data in memory as Unicode, so
 everything going into Java must be converted into Unicode.  Currently,
 there is no way Java can tell whether a file is ascii or Greek or
 Japanese or whatever.  So, you have to Unicode escape the files.
 native2ascii makes life a bit easier.  ;)

Ok this is true, and maybe we are getting a bit out of topic but, why cant I 
just save the file in UTF-8 format? Isn't that unicode? :/

Also, while searching for a solution I came across the load(InputStream) 
method of java.util.Properties which has the value of charset hardcoded to 
8859_1 which made me wonder...

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Application Resources and TextTool

2005-02-10 Thread Markos Charatzas
Hello Nathan,

Thank you for your prompt and detailed response.

Yeah its true that I use request.setAttribute(destinations, destinations) at 
some point before rendering the template so that what is must be causing the 
problem.

So...does that mean that I have to keep a record of every possible entry made 
to the request? How do I go on about this?

Thanks in advance,
Markos Charatzas

On Wednesday 09 February 2005 19:25, Nathan Bubna wrote:
 the relevant code (in veltools 1.1's StrutsUtils) is doing the following:

 resources = (MessageResources) request.getAttribute(bundle +
 moduleConfig.getPrefix());

 if (resources == null) {
 resources = (MessageResources) app.getAttribute(bundle +
 moduleConfig.getPrefix());
 }

 this seems to indicate that there is something in either your request
 attributes or servlet context attributes under the key destinationsX
 (where X is your module config prefix) that is not a MessageResources
 object.  i'm not sure how this would happen, but it is.  for tracking
 the problem down, you might first try retrieving that object yourself
 and finding out what it is.  you might also grep your app to find any
 other place that an object would end up in your request or servlet
 context attributes with that same key, because something is probably
 doing so and thus replacing the MessageResources object that should be
 there.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Charset (Struts and Velocity)

2005-02-10 Thread Markos Charatzas
Hi Shinobu,

 #*
 Actually, the output.encoding doesn't matter unless you're using
 VelocityServlet or Anakia.  ;)

Yeap you are right...it must have been there since we migrated to 
VelocityViewServlet :)

 Please refresh my memory.  Was there a way to specify content type
 in resource files?  I thought they were just PropertyResourceBundle
 files.

I meant charset, thanks for pointing that out.

 Question marks usually means that the charset converter couldn't find
 the suitable character for the conversion.  If you spit out some log
 from java, is it encoded properly, or do you get question marks there,
 too?

Yeah, everything comes out fine in all except when the output comes from a 
resource bundle :/

Thank you.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Application Resources and TextTool

2005-02-09 Thread Markos Charatzas
Hi all,

I get this weird bug(?) with TextTool.
On my struts-config.xml I declare the following message resource

message-resources parameter=DestinationsResources key=destinations /

then in my template I use the textool to retrieve a value from that resource

$text.get('title.img', 'destinations')

and I get a ClassCastException with the following stack trace,

java.lang.ClassCastException
 at org.apache.velocity.tools.struts.StrutsUtils.getMessageResources(Unknown 
Source)
 at org.apache.velocity.tools.struts.MessageResourcesTool.getResources(Unknown 
Source)
 at org.apache.velocity.tools.struts.MessageTool.get(Unknown Source)
 at org.apache.velocity.tools.struts.MessageTool.get(Unknown Source)



changed the key of the message resource to destination (notice the 's' 
missing)

using the new key value... and it works :/

thats using velocity-tools-1.1

I also have other resources that use the same notation, 
message-resources parameter=IndexResources key=index /

and cause me no problems.

Thanks in advance,
Markos Charatzas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Charset (Struts and Velocity)

2005-02-09 Thread Markos Charatzas
Hi there,

Although,

1. I have defined the charset in struts-config.xml like the following
controller contentType=text/html; charset=ISO-8859-7/
2. In velocity properties I have set both 
input.encoding=ISO-8859-7
output.encoding=ISO-8859-7
3. my html templates have the content type set properly
4. my resource files are in the corrent content type

I still get question marks (?) displayed back to the browser when displaying 
anything that comes from an ApplicationResource file :(

Thanks in advance.
Markos Charatzas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts Velocity

2005-02-08 Thread Markos Charatzas
Hi all,

Im just trying to get my head around this. Struts is meant to work with
actions. You create the mappings of the actions in the struts-config.xml and
define things like action handlers, forwards, etc.

Suppose I use Velocity to render the view.

Is there a standar place in struts or anywhere else that I can populate the
velocity context? (Doing it through request.put() of course)

My problem comes when I need to change the Locale for a page which fires up a
LocaleAction class which then renders the page Ive specified *but* without
the velocity context being populated since all the logic to populate the
context is defined in a different class.

In Turbine for example there is method which gets called and serves for
populating the context.

Thanks for your input.
Markos Charatzas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts Velocity

2005-02-08 Thread Markos Charatzas
Thanks for your input!

 The easy way is to use the Velocity Servlet in velocity tools. By mapping
 say any vm file to the servlet you can process vm files. And yes, putting
 the data in the request or the session will make it available to the view.
 There isn't anywhere else really.


Yeah thats what im doing :D


 The exception is where method calls are made directly from the Velocity I
 suppose. Perhaps I'm dumb - but why is an action - the LocaleAction
 rendering anything? Shouldn't that be the job of Velocity?

I didnt put it correct. I dont mean that the LocaleAction renders the page, I 
mean first calling LocaleAction *and* then rendering the page. So the 
question is when to call request.put().

At the moment I found a solution by declaring a global forward which always 
calls the associated action with a given page (passed as a parameter) which 
handles the request.put in the execute method.

However, Im not 100% sure its the right way since I would imagine an Action 
class would only handle all the business logic to prepare the objects for 
request.put and not actually making it.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts Velocity

2005-02-08 Thread Markos Charatzas
Peter, you are 100% right that it should belong there. Actually the way I see 
it is that as ActionServlet handles Actions so VelocityViewServlet should 
handle Views! :) 

 Perhaps we will implement it ourselves actually since we are moving into
 the Chinese market this year.
Well that is why they call it OpenSource I guess :)

Nathan, Im aware of VelocityViewServlet and that is what I use :) but its good 
that you mentioned it to avoid misunderstanding.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]