You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Jenny Mathew -X (jenmathe - Infosys at Cisco)" <je...@cisco.com> on 2005/11/15 12:49:54 UTC

Escaping JAVA in template scripts possible?

Hi all,

Is there some way to make #if($item instanceof XYZ) work? 
Ie escaping the above java code? 

Regards
Jenny

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


Re: Escaping JAVA in template scripts possible?

Posted by Glenn Holmer <gh...@weycogroup.com>.
On Tuesday 15 November 2005 14:38, James Kebinger wrote:
> Is there a gravitational law for templating languages?
> A templating language can emerge from the primordial ooze of mingled
> logic and presentation, but there will always be an irresistable
> downward pull by users to add features to undo the very reasons for
> the templating language's existance.
> Are there any that have reached a proverbial "escape velocity"?

LOL!

-- 
____________________________________________________________
Glenn Holmer                          gholmer@weycogroup.com
Software Engineer                        phone: 414-908-1809
Weyco Group, Inc.                          fax: 414-908-1601

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


Re: Escaping JAVA in template scripts possible?

Posted by James Kebinger <jk...@gmail.com>.
Is there a gravitational law for templating languages?
A templating language can emerge from the primordial ooze of mingled logic
and presentation, but there will always be an irresistable downward pull by
users to add features to undo the very reasons for the templating language's
existance.
Are there any that have reached a proverbial "escape velocity"?

On 11/15/05, Nathan Bubna <nb...@gmail.com> wrote:
>
> for executing an instanceof check, then Use A Tool (tm). :)
>
> public class InstanceOfTool {
> public boolean isInstanceOf(Object a, String classname) {
> Class cls = Class.forName(classname);
> return cls.isInstance(a);
> }
> }
>
> but of course, i don't recommend using such a tool for the reasons
> James said. :)
>
> On 11/15/05, Will Glass-Husain <wg...@forio.com> wrote:
> > What do you mean by escaping java? Do you mean displaying java code
> > literally (yes) or executing java in the page (yes for method calls, no
> for
> > everything else).
> >
> >
> > ----- Original Message -----
> > From: "Jenny Mathew -X (jenmathe - Infosys at Cisco)" <
> jenmathe@cisco.com>
> > To: "Velocity Users List" <ve...@jakarta.apache.org>
> > Sent: Tuesday, November 15, 2005 3:49 AM
> > Subject: Escaping JAVA in template scripts possible?
> >
> >
> > Hi all,
> >
> > Is there some way to make #if($item instanceof XYZ) work?
> > Ie escaping the above java code?
> >
> > Regards
> > Jenny
> >
> > ---------------------------------------------------------------------
> > 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
>
>

Re: Escaping JAVA in template scripts possible?

Posted by Nathan Bubna <nb...@gmail.com>.
for executing an instanceof check, then Use A Tool (tm). :)

public class InstanceOfTool {
  public boolean isInstanceOf(Object a, String classname) {
     Class cls = Class.forName(classname);
     return cls.isInstance(a);
  }
}

but of course, i don't recommend using such a tool for the reasons
James said. :)

On 11/15/05, Will Glass-Husain <wg...@forio.com> wrote:
> What do you mean by escaping java?  Do you mean displaying java code
> literally (yes) or executing java in the page (yes for method calls, no for
> everything else).
>
>
> ----- Original Message -----
> From: "Jenny Mathew -X (jenmathe - Infosys at Cisco)" <je...@cisco.com>
> To: "Velocity Users List" <ve...@jakarta.apache.org>
> Sent: Tuesday, November 15, 2005 3:49 AM
> Subject: Escaping JAVA in template scripts possible?
>
>
> Hi all,
>
> Is there some way to make #if($item instanceof XYZ) work?
> Ie escaping the above java code?
>
> Regards
> Jenny
>
> ---------------------------------------------------------------------
> 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


Re: Escaping JAVA in template scripts possible?

Posted by Will Glass-Husain <wg...@forio.com>.
What do you mean by escaping java?  Do you mean displaying java code 
literally (yes) or executing java in the page (yes for method calls, no for 
everything else).


----- Original Message ----- 
From: "Jenny Mathew -X (jenmathe - Infosys at Cisco)" <je...@cisco.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Tuesday, November 15, 2005 3:49 AM
Subject: Escaping JAVA in template scripts possible?


Hi all,

Is there some way to make #if($item instanceof XYZ) work?
Ie escaping the above java code?

Regards
Jenny

---------------------------------------------------------------------
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


Re: Escaping JAVA in template scripts possible?

Posted by James Kebinger <jk...@gmail.com>.
Man, I hope not, or one's typical velocity template will end up looking as
messy a typical JSP with its messy blend of presentation and business logic.

On 11/15/05, Jenny Mathew -X (jenmathe - Infosys at Cisco) <
jenmathe@cisco.com> wrote:
>
> Hi all,
>
> Is there some way to make #if($item instanceof XYZ) work?
> Ie escaping the above java code?
>
> Regards
> Jenny
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>