Re: Dereferencing a Reference

2006-06-08 Thread Nathan Bubna
#set( $systemClass = $secureHashMap.class.forName(java.lang.System) ) #set( $exitMethod = $systemClass.getMethod(exit, $null) ) $exitMethod.invoke($null, $null) In other words, if you allow untrusted parties to create and run templates on your system, you need to read

Re: Dereferencing a Reference

2006-06-08 Thread Keith R. Bennett
Barbara - Jakarta Commons Collections has all kinds of neat classes and utilities for this kind of thing. While unfortunately they don't support generics, larvalabs has a product that does. The URL http://collections.sourceforge.net redirects to http://larvalabs.com/collections/. The

Re: Dereferencing a Reference

2006-06-08 Thread Barbara Baughman
Cool. Thanks. Barbara Baughman X2157 On Thu, 8 Jun 2006, Keith R. Bennett wrote: Barbara - Jakarta Commons Collections has all kinds of neat classes and utilities for this kind of thing. While unfortunately they don't support generics, larvalabs has a product that does. The URL

Dereferencing a Reference

2006-06-07 Thread Keith R. Bennett
What Velocity template code can I use to get a list of keys and iterate over that list, getting the value corresponding to each key? Here is what I've tried so far: Before calling Velocity, I place the list of keys plus each key/value pair in the context. For example: -- String [] letters

Re: Dereferencing a Reference

2006-06-07 Thread Barbara Baughman
Try using a Map interface object like HashMap or TreeMap. HashMapString, String hm=new HashMapString, String(); hm.put(a,apple); hm.put(b,blueberry); ctx.put(map,hm); Then in Velocity: #foreach ($key in $map.keySet()) $key $map.get($key) #end Barbara Baughman X2157 On Wed, 7 Jun 2006,

Re: Dereferencing a Reference

2006-06-07 Thread Keith R. Bennett
Barbara - Thank you, that worked beautifully. I remember reading somewhere, though, that allowing a template to call arbitrary methods (that is, methods other than bean-like getters) on classes was dangerous, and that support for it might be eliminated in a future version. Is this true, and

Re: Dereferencing a Reference

2006-06-07 Thread Nathan Bubna
Allowing a template to call arbitrary methods is only dangerous if you are allowing 3rd-parties to create templates and do not have your java security policies properly configured for that. Calling arbitrary methods does also allow for bad design if you allow methods which change model state to