You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Xuan Han <xh...@inktomi.com> on 2002/04/17 23:55:06 UTC
java method invoke problem
I have a public Encoder java object pushed into Context. It has a method:
public String encode( String).
In my vm macro, I invoke method on the Encoder.
#set( $valueEncoded = $Encoder.encode($value) )
but the value is printed as "Encoder@9f47....", not the encocded string I
expected. What's causing the problem here? Thanks,
-Xuan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: java method invoke problem
Posted by Xuan Han <xh...@inktomi.com>.
thanks. Eventually it's working!
-Xuan
-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
Sent: Wednesday, April 17, 2002 4:05 PM
To: velocity-user@jakarta.apache.org
Subject: Re: java method invoke problem
On 4/17/02 6:02 PM, "Xuan Han" <xh...@inktomi.com> wrote:
> here it is:
>
> import java.net.*;
>
> public class Encoder
> {
> public String encode (String url)
> {
> return ( URLEncoder.encode( url ) );
> }
> }
>
That looks fine. I just used it with a template
#set($foo = $encoder.encode("hello there"))
$foo
And the output was
hello+there
As I expect.
What is output when you do
$encoder
$encoder.encode("hello there")
>
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Wednesday, April 17, 2002 3:00 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: java method invoke problem
>
>
> On 4/17/02 5:55 PM, "Xuan Han" <xh...@inktomi.com> wrote:
>
>> I have a public Encoder java object pushed into Context. It has a
method:
>> public String encode( String).
>>
>> In my vm macro, I invoke method on the Encoder.
>> #set( $valueEncoded = $Encoder.encode($value) )
>>
>> but the value is printed as "Encoder@9f47....", not the encocded string I
>> expected. What's causing the problem here? Thanks,
>
> Hard to say. Can we see the Encoder class?
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
> You're going to end up getting pissed at your software
> anyway, so you might as well not pay for it. Try Open Source.
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> 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
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: java method invoke problem
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 4/17/02 6:02 PM, "Xuan Han" <xh...@inktomi.com> wrote:
> here it is:
>
> import java.net.*;
>
> public class Encoder
> {
> public String encode (String url)
> {
> return ( URLEncoder.encode( url ) );
> }
> }
>
That looks fine. I just used it with a template
#set($foo = $encoder.encode("hello there"))
$foo
And the output was
hello+there
As I expect.
What is output when you do
$encoder
$encoder.encode("hello there")
>
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Wednesday, April 17, 2002 3:00 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: java method invoke problem
>
>
> On 4/17/02 5:55 PM, "Xuan Han" <xh...@inktomi.com> wrote:
>
>> I have a public Encoder java object pushed into Context. It has a method:
>> public String encode( String).
>>
>> In my vm macro, I invoke method on the Encoder.
>> #set( $valueEncoded = $Encoder.encode($value) )
>>
>> but the value is printed as "Encoder@9f47....", not the encocded string I
>> expected. What's causing the problem here? Thanks,
>
> Hard to say. Can we see the Encoder class?
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
> You're going to end up getting pissed at your software
> anyway, so you might as well not pay for it. Try Open Source.
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> 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
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: java method invoke problem
Posted by Xuan Han <xh...@inktomi.com>.
here it is:
import java.net.*;
public class Encoder
{
public String encode (String url)
{
return ( URLEncoder.encode( url ) );
}
}
-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
Sent: Wednesday, April 17, 2002 3:00 PM
To: velocity-user@jakarta.apache.org
Subject: Re: java method invoke problem
On 4/17/02 5:55 PM, "Xuan Han" <xh...@inktomi.com> wrote:
> I have a public Encoder java object pushed into Context. It has a method:
> public String encode( String).
>
> In my vm macro, I invoke method on the Encoder.
> #set( $valueEncoded = $Encoder.encode($value) )
>
> but the value is printed as "Encoder@9f47....", not the encocded string I
> expected. What's causing the problem here? Thanks,
Hard to say. Can we see the Encoder class?
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: java method invoke problem
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 4/17/02 5:55 PM, "Xuan Han" <xh...@inktomi.com> wrote:
> I have a public Encoder java object pushed into Context. It has a method:
> public String encode( String).
>
> In my vm macro, I invoke method on the Encoder.
> #set( $valueEncoded = $Encoder.encode($value) )
>
> but the value is printed as "Encoder@9f47....", not the encocded string I
> expected. What's causing the problem here? Thanks,
Hard to say. Can we see the Encoder class?
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>