Re: Adding map to toolbox
Never mind, I got it. It was printing it because return value for all these map.put operations was NULL. call to clear() wasn't printed because it is void. I put this all like this, and it's working now - !-- $mymap.clear() $mymap.put(label.name,manish) $mymap.put(label.country, India) -- - Manish - Original Message - From: Manish [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Monday, January 31, 2005 7:32 PM Subject: Adding map to toolbox Well, I tried to ad a HashMap to a toolbox as well, but none of its methods (put basically) is working except clear() This is what I did in tool box- tool keymymap/key scopeapplication/scope classjava.util.HashMap/class /tool Then I my velocity code I try this - $mymap.clear() $mymap.put(label.name,manish) $mymap.put(label.country, India) but It doesn't work. The template shows me this - $mymap.put(label.name,manish) $circus.map.put(label.country, India) The clear is not shown, so I am assuming that it's getting executed a $mymap is not NULL. Any help, pointers??? TIA, - Manish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding map to toolbox
or you can just use quiet notation: $!mymap.put('label.name', 'manish') On Mon, 31 Jan 2005 19:58:31 +0530, Manish [EMAIL PROTECTED] wrote: Never mind, I got it. It was printing it because return value for all these map.put operations was NULL. call to clear() wasn't printed because it is void. I put this all like this, and it's working now - !-- $mymap.clear() $mymap.put(label.name,manish) $mymap.put(label.country, India) -- - Manish - Original Message - From: Manish [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Monday, January 31, 2005 7:32 PM Subject: Adding map to toolbox Well, I tried to ad a HashMap to a toolbox as well, but none of its methods (put basically) is working except clear() This is what I did in tool box- tool keymymap/key scopeapplication/scope classjava.util.HashMap/class /tool Then I my velocity code I try this - $mymap.clear() $mymap.put(label.name,manish) $mymap.put(label.country, India) but It doesn't work. The template shows me this - $mymap.put(label.name,manish) $circus.map.put(label.country, India) The clear is not shown, so I am assuming that it's getting executed a $mymap is not NULL. Any help, pointers??? TIA, - Manish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding map to toolbox
I did indeed put quiet notation, just forgot to add it here. - Manish - Original Message - From: Nathan Bubna [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Monday, January 31, 2005 9:21 PM Subject: Re: Adding map to toolbox or you can just use quiet notation: $!mymap.put('label.name', 'manish') On Mon, 31 Jan 2005 19:58:31 +0530, Manish [EMAIL PROTECTED] wrote: Never mind, I got it. It was printing it because return value for all these map.put operations was NULL. call to clear() wasn't printed because it is void. I put this all like this, and it's working now - !-- $mymap.clear() $mymap.put(label.name,manish) $mymap.put(label.country, India) -- - Manish - Original Message - From: Manish [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Monday, January 31, 2005 7:32 PM Subject: Adding map to toolbox Well, I tried to ad a HashMap to a toolbox as well, but none of its methods (put basically) is working except clear() This is what I did in tool box- tool keymymap/key scopeapplication/scope classjava.util.HashMap/class /tool Then I my velocity code I try this - $mymap.clear() $mymap.put(label.name,manish) $mymap.put(label.country, India) but It doesn't work. The template shows me this - $mymap.put(label.name,manish) $circus.map.put(label.country, India) The clear is not shown, so I am assuming that it's getting executed a $mymap is not NULL. Any help, pointers??? TIA, - Manish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding map to toolbox
Hi Manish, I did indeed put quiet notation, just forgot to add it here. The down side of using Maps like this is that when it has a prior value, that's going to be printed. (Well, you might want that...) To make sure nothing gets printed, I sometimes do this: #set($sink = $map.put('foo', 'bar')) ## I don't like calling state-changing methods from VTL, though... Best regards, -- Shinobu -- Shinobu Kawai Yoshida [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]