"Matthias Hendler" <[EMAIL PROTECTED]> writes: >Hello,
>thanx for the many answers. >What I forgot to mention is that I use Velocity 1.4. Ok. I tried with that version. >I have tested a lot with my code before. >My java code looks like this: >final VelocityEngine ve = new VelocityEngine(); >... >final VelocityContext context; >context = new VelocityContext(); >// TODO MHE >context.put("myMap", new HashMap()); >context.put("myList", new ArrayList()); >context.put("myTable", new Hashtable()); >... >// Velocity >final boolean success = ve.evaluate(context, writerVelocity, "Velocity", >readerEscaped); >.... >My template looks like this: >1. $myMap.toString() >2. $myMap.getClass() >3. $myMap.isEmpty() >4. ${myMap.put("tttt123", "test")} Ok. I tried that code and while I have to say that, it works fine for me. >Ouput of the template IF line 4 is "deleted". >1. {} >2. class java.util.HashMap >3. true Just write $!{myMap... and it won't bother you anyway. :-) >If line 4 is part of the template I sill get the invalid reference exception. Hm. Maybe I'm getting something wrong. Where do you get this exception? On screen / in the template? In a log file? I can't reproduce it but I'd love to. Do you load any velocity.properties? From your code I'd say not. >So, I did some testing around my problem. >Conclusion: >1. $myList.set(0, "Hallo") >This works. Sure. java.util.List::set(int index, Object element) >2. ${myMap.put("tttt123", "test")} Works fine for me. >or >3. $myTable.put("test", "hallo") Works fine for me, too. >Any ideas why it works in case 1 and not in case 2 and 3? I'd like to see the exception. Can you send it to me (either through the list or directly). Best regards Henning >-- >Echte DSL-Flatrate dauerhaft für 0,- Euro*! >"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] -- Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH [EMAIL PROTECTED] +49 9131 50 654 0 http://www.intermeta.de/ RedHat Certified Engineer -- Jakarta Turbine Development -- hero for hire Linux, Java, perl, Solaris -- Consulting, Training, Development Social behaviour: Bavarians can be extremely egalitarian and folksy. -- http://en.wikipedia.org/wiki/Bavaria Most Franconians do not like to be called Bavarians. -- http://en.wikipedia.org/wiki/Franconia --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]