Need help with Map in Webmacro
Raghavan Kandala <[email protected]> Thu, 10 Nov 2005 11:35:55 +0530
| Newsgroups | gmane.comp.java.webmacro.user |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I am using Map in my webmacro templates and I see unexpected output on second and following
parses of this webmacro template. Here is the relevant WebMacro code
---------------------------------------------------------------------------------------
#include as macro "macro.wmm" ...
$Layout.parse("comps/globals.wm")
$Layout.setTitle("$currentDomainId-Editor tasks")
## this will set the "header" property based on our skin
$Layout.parse("comps/headswitch.wm")
$Layout.setLayout("layout/layout-normal.wm")
$Layout.setOnLoad("document.srchForm.keyword.focus()")
$Layout.addScriptFile("../p/js/nodes.js")
$Layout.addScriptFile("../p/js/wmpagelets.js")
$Layout.setProperty("footer","comps/myspace_tail.wm")
## The Map related code
curNodeMap1 : $curNodeMap <br>
#set $curNodeMap = {"a":"abc"}
curNodeMap2 : $curNodeMap <br>
#set $curNodeMap = {}
curNodeMap3 empty : $curNodeMap <br>
#set $curNodeMap = {"a":"abc"}
curNodeMap4 (a: abc) : $curNodeMap <br>
#set $no = $curNodeMap.put("b","bcd")
curNodeMap5 (2 elements): $curNodeMap <br>
<a href="Nodes?request=Post&treeType=cat&urlid=pantoto&req=101"> click me </a>
******************************
----------------------------------------------------------------------------------------------
The <a> link calls the servlet that calls this webmacro template again.
When called for the first time this is the output produced (which is what is expected).
############## OUTPUT ###################
curNodeMap1 :
curNodeMap2 : {a=abc}
curNodeMap3 empty : {}
curNodeMap4 (a: abc) : {a=abc}
curNodeMap5 (2 elements): {a=abc, b=bcd}
click me ******************************
############## END OF OUTPUT ###################
But when I try to call the servlet again (by clicking on the link), then I get a
different output which is not expected.
############## OUTPUT ###################
curNodeMap1 :
curNodeMap2 : {a=abc}
curNodeMap3 empty : {}
curNodeMap4 (a: abc) : {a=abc, b=bcd}
curNodeMap5 (2 elements): {a=abc, b=bcd}
click me ******************************
############## END OF OUTPUT ###################
It appears to be bug in the current release of webmacro.
Or am I doing something wrong.
Hope someone has some insight.
Thanks in advance,
Raghavan.
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php