You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Peter Romianowski <me...@gmx.de> on 2002/04/16 14:15:23 UTC

Problem passing parameter

Hi,

I have a weird problem. I want to do the following:

$obj.getSomething( "param1", $obj2.getALongValue())

whereas $obj2.getALongValue() returns a value of 
type long (primitive). The result is that velocity
renders this as text instead of evaluating it.
When I put $obj2.getALongValue() somewhere in my 
template, it renders correctly to the value of
the method-call. If I do something like:

#set ($value = 2) <-- Note: NOT a long
$obj.getSomething( "param1", $value)

it renders correctly. Does velocity have a 
problem with long parameters? I think I remember
a maildiscussion about that, but I am not sure
(and I was not able to find something in the
archives).

Am I missing something? If this is a bug - is there
a workaround? BTW: I use velocity-1.2.

Peter


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


Re: Problem passing parameter

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 4/16/02 9:10 AM, "Peter Romianowski" <me...@gmx.de> wrote:

>> 
>> No, but we can fix it :)
>> 
>> I need it for the client's project I am working on, so might as well do it
>> now.
> 
> That would be GREAT! What would be the result of the fix? Do I have to use
> 1.4dev then? Is it stable enough for production?

At the moment it is, but that will change soon :)


If the fix is small - really small - and really clear - we could talk about
rolling into 1.3.  


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

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


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


RE: Problem passing parameter

Posted by Peter Romianowski <me...@gmx.de>.
> 
> No, but we can fix it :)
> 
> I need it for the client's project I am working on, so might as well do it
> now.

That would be GREAT! What would be the result of the fix? Do I have to use
1.4dev then? Is it stable enough for production?

Thanks,
Peter

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


Re: Problem passing parameter

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 4/16/02 8:57 AM, "Peter Romianowski" <me...@gmx.de> wrote:

> Hi,
> 
>>> Am I missing something? If this is a bug - is there
>>> a workaround? BTW: I use velocity-1.2.
>> 
>> I've run into the same thing...
>> 
>> Could you try with the 1.4 latest?
> 
> Done (NB 15/04). But the result stays the same :( Any ideas for a
> workaround?
> 

No, but we can fix it :)

I need it for the client's project I am working on, so might as well do it
now.

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting

Maven & Gump are friends


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


RE: Problem passing parameter

Posted by Peter Romianowski <me...@gmx.de>.
Hi,

> > Am I missing something? If this is a bug - is there
> > a workaround? BTW: I use velocity-1.2.
> 
> I've run into the same thing...
> 
> Could you try with the 1.4 latest?

Done (NB 15/04). But the result stays the same :( Any ideas for a 
workaround?

Peter

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


Re: Problem passing parameter

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 4/16/02 8:15 AM, "Peter Romianowski" <me...@gmx.de> wrote:

> Hi,
> 
> I have a weird problem. I want to do the following:
> 
> $obj.getSomething( "param1", $obj2.getALongValue())
> 
> whereas $obj2.getALongValue() returns a value of
> type long (primitive). The result is that velocity
> renders this as text instead of evaluating it.
> When I put $obj2.getALongValue() somewhere in my
> template, it renders correctly to the value of
> the method-call. If I do something like:
> 
> #set ($value = 2) <-- Note: NOT a long
> $obj.getSomething( "param1", $value)
> 
> it renders correctly. Does velocity have a
> problem with long parameters? I think I remember
> a maildiscussion about that, but I am not sure
> (and I was not able to find something in the
> archives).
> 
> Am I missing something? If this is a bug - is there
> a workaround? BTW: I use velocity-1.2.

I've run into the same thing...

Could you try with the 1.4 latest?

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Java : the speed of Smalltalk with the simple elegance of C++... 


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


Re: Template Caching

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 4/16/02 8:36 AM, "Peter Romianowski" <me...@gmx.de> wrote:

>> I had a similar problem, did a private workaround, but can put in the 1.4
>> tree if it's useful.
>> 
>> The idea is just to add something along the lines of
>> 
>>   public Template makeTemplate(Reader);
>> 
>> So that you can create and cache your own templates, getting the benefit of
>> the cache....
> 
> +1 for that. I think there are enough use cases for that.
> 
>> I am not sure if that is better than your own resource loader - with your
>> own loader, that extracts the <template> from the doc, you could keep the
>> 'standard model' of
>> 
>>   Template t = getResource("foobar.xml");
>> 
>> And get all of Velocity's cache management for free...
> 
> Idea #1 would work better for me, since I process the XML-file in another
> part of my application that has fairly nothing to do with velocity (In fact
> I use a pluggable "template-renderer-framework", where velocity is just
> one choice among others).

But the best one :)

> 
> Another question: I saw the latest release is 1.3rc1. The development is
> 1.4 - what will be the next release? 1.3 or 1.4. And is there any schedule
> for a release?

I was going to push out 1.3rc2 last night, but fell asleep.  Look for it
tonight.  That's the path to the 1.3 release.  The slowness is because of a
bug that was found late in 1.3-dev which appears to be fixed, but being
cautious.

The 1.4-dev is the current dev tree...

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

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"We will be judged not by the monuments we build, but by the monuments we
destroy" - Ada Louise Huxtable


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


RE: Template Caching

Posted by Peter Romianowski <me...@gmx.de>.
> I had a similar problem, did a private workaround, but can put in the 1.4
> tree if it's useful.
> 
> The idea is just to add something along the lines of
> 
>   public Template makeTemplate(Reader);
> 
> So that you can create and cache your own templates, getting the benefit of
> the cache....

+1 for that. I think there are enough use cases for that.
 
> I am not sure if that is better than your own resource loader - with your
> own loader, that extracts the <template> from the doc, you could keep the
> 'standard model' of
> 
>   Template t = getResource("foobar.xml");
> 
> And get all of Velocity's cache management for free...

Idea #1 would work better for me, since I process the XML-file in another
part of my application that has fairly nothing to do with velocity (In fact
I use a pluggable "template-renderer-framework", where velocity is just
one choice among others).

Another question: I saw the latest release is 1.3rc1. The development is
1.4 - what will be the next release? 1.3 or 1.4. And is there any schedule
for a release?

Thanks,
Peter

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


Re: Template Caching

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 4/16/02 8:23 AM, "Peter Romianowski" <me...@gmx.de> wrote:

> Hi (again for a second topic :),
> 
> I use velocity the "standard"-way with .vm-Files and another
> way with XML-templates that look like this:
> 
> <root>
> <something>
> ...
> </something>
> 
> <template>
> #set ($velocity = "great velocity")
> here comes some $velocity-stuff
> </template>
> </root>
> 
> Now that my application gets under heavy load I want
> to use the template (grammar)-caching, that is used
> by velocity working with files.
> During the processing of the XML-file I extract the
> content of the node "template" and pass it to
> Velocity.evaluate (...) which is recreating the grammar
> upon every call, right?
> 
> Is there a way to use grammar-caching within my approach?
> Will I have to implement my own ResourceLoader?
> 
> Thanks in advance,

I had a similar problem, did a private workaround, but can put in the 1.4
tree if it's useful.

The idea is just to add something along the lines of

  public Template makeTemplate(Reader);

So that you can create and cache your own templates, getting the benefit of
the cache....

I am not sure if that is better than your own resource loader - with your
own loader, that extracts the <template> from the doc, you could keep the
'standard model' of

  Template t = getResource("foobar.xml");

And get all of Velocity's cache management for free...


-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting

Maven & Gump are friends


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


Template Caching

Posted by Peter Romianowski <me...@gmx.de>.
Hi (again for a second topic :),

I use velocity the "standard"-way with .vm-Files and another 
way with XML-templates that look like this:

<root>
	<something>
		...
	</something>

	<template>
		#set ($velocity = "great velocity")
		here comes some $velocity-stuff
	</template>
</root>

Now that my application gets under heavy load I want
to use the template (grammar)-caching, that is used 
by velocity working with files.
During the processing of the XML-file I extract the 
content of the node "template" and pass it to
Velocity.evaluate (...) which is recreating the grammar
upon every call, right?

Is there a way to use grammar-caching within my approach?
Will I have to implement my own ResourceLoader?

Thanks in advance,

Peter

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