You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Pramod Kumar <pr...@siptech.co.in> on 2001/11/16 10:37:55 UTC
How do I use Java code in VTL
Dear Sir,
How can I use Java code for VTL. And also I want to know how do I
declare a Java Object.
Thanks
Pramod.
_________________________________
Pramod Kumar Mahapatra
SIP Technologies & Exports Limited
Elnet Software City, Taramani
Chennai - 600 113
Email ID: mpramodkumar@yahoo.com
mpramodkumar@excite.com
_________________________________
Re: How do I use Java code in VTL
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/16/01 11:06 AM, "Nick Bauman" <ni...@cortexity.com> wrote:
> Well, since what everyone is saying is merely tecnically correct, I'll try
> and answer your question that is both technically correct and helpful to
> you. ;)
>
> You cannot typically directly declare a java object in Velocity except for
> Strings and Integers via the #set directive
And if you want to be *completely* technically correct, you might add
ArrayList to that set...
#set($foo = [1,2,3])
>
> Beyond that, _accessing_ Java code placed into the context is very easy in
> Velocity. You have a loosely-typed world (the web) to match a loosely-typed
> language, which is not the case with JSP.
>
> So when you create your Context is when you can place powerful tools
> written in Java into your page, analagous to the useBean tag in JSP, from a
> Servlet.
>
>> Dear Sir,
>>
>> How can I use Java code for VTL. And also I want to know how do I
>> declare a Java Object.
>>
>> Thanks
>> Pramod.
>> _________________________________
>>
>> Pramod Kumar Mahapatra
>> SIP Technologies & Exports Limited
>> Elnet Software City, Taramani
>> Chennai - 600 113
>> Email ID: mpramodkumar@yahoo.com
>> mpramodkumar@excite.com
>> _________________________________
>
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"Whoever would overthrow the liberty of a nation must begin by subduing the
freeness of speech." - Benjamin Franklin
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: How do I use Java code in VTL
Posted by Nick Bauman <ni...@cortexity.com>.
Well, since what everyone is saying is merely tecnically correct, I'll try
and answer your question that is both technically correct and helpful to
you. ;)
You cannot typically directly declare a java object in Velocity except for
Strings and Integers via the #set directive
Beyond that, _accessing_ Java code placed into the context is very easy in
Velocity. You have a loosely-typed world (the web) to match a loosely-typed
language, which is not the case with JSP.
So when you create your Context is when you can place powerful tools
written in Java into your page, analagous to the useBean tag in JSP, from a
Servlet.
> Dear Sir,
>
> How can I use Java code for VTL. And also I want to know how do I
> declare a Java Object.
>
> Thanks
> Pramod.
> _________________________________
>
> Pramod Kumar Mahapatra
> SIP Technologies & Exports Limited
> Elnet Software City, Taramani
> Chennai - 600 113
> Email ID: mpramodkumar@yahoo.com
> mpramodkumar@excite.com
> _________________________________
--
Nick Bauman
Cortexity Development
Intellectual Process is more important than
Intellectual Property -- you'll see.
http://www.cortexity.com/
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: How do I use Java code in VTL
Posted by Konstantin Priblouda <kp...@yahoo.com>.
--- Pramod Kumar <pr...@siptech.co.in> wrote:
> Dear Sir,
>
> How can I use Java code for VTL. And also I want
> to know how do I
> declare a Java Object.
AFAIK, you can not. Point in using VTL is to get
rid of java code in templates. If you like to,
you can use JSP...
regards,
=====
Konstantin Priblouda ( ko5tik ) Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >
__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: How do I use Java code in VTL
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/16/01 4:37 AM, "Pramod Kumar" <pr...@siptech.co.in> wrote:
> Dear Sir,
>
> How can I use Java code for VTL. And also I want to know how do I
> declare a Java Object.
You can't.
This is one of the differences between Velocity and JSP - we by design will
not let the designer write Java code in the templates.
There are quite a few reasons why you don't want to do this in any even
marginally real application, mostly revolving around security, delineation
of role (designers, programmers), maintainabliity (keep business logic from
being repeated in unknown places), and inabliity to force a clean separation
of View from the other application pieces.
Geir
>
> Thanks
> Pramod.
> _________________________________
>
> Pramod Kumar Mahapatra
> SIP Technologies & Exports Limited
> Elnet Software City, Taramani
> Chennai - 600 113
> Email ID: mpramodkumar@yahoo.com
> mpramodkumar@excite.com
> _________________________________
>
>
--
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>