dev@jsftemplating.java.net

mapPut not adding to the existing Map

From: Priti Tiwary <Priti.Tiwary_at_Sun.COM>
Date: Tue, 26 Sep 2006 08:45:41 -0700

Hi,
I am trying to add entries to a Map dynamically. Entries which i am
trying to add have unique keys . On dunping attributes, i see only one
entry always in the Map. Can someone see any reason why.
Here is a working example.
selectedRows as dumped in server.log shows the map has only one entry.
Priti

-- 
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Priti Tiwary          		M/S SCA16-2425
Sun Microsystems, Inc.		4160 Network Circle
Voice: +1 408 276 5559          Santa Clara, CA 95054      
Cell: +1 510 396 4431           United States    
				     
				     

$attribute{row1}); mapPut(map="$attribute{row1}" key="a" value="Row1 Col A"); mapPut(map="$attribute{row1}" key="b" value="Row1 Col B"); mapPut(map="$attribute{row1}" key="c" value="Row1 Col C"); // Row 2 createMap(result=>$attribute{row2}); mapPut(map="$attribute{row2}" key="a" value="Row2 Col A"); mapPut(map="$attribute{row2}" key="b" value="Row2 Col B"); mapPut(map="$attribute{row2}" key="c" value="Row2 Col C"); // Row 3 createMap(result=>$attribute{row3}); mapPut(map="$attribute{row3}" key="a" value="Row3 Col A"); mapPut(map="$attribute{row3}" key="b" value="Row3 Col B"); mapPut(map="$attribute{row3}" key="c" value="Row3 Col C"); // Create List of Map (List of the rows) setAttribute(key='listOfRows' value={"$attribute{row1}" "${row2}" "${row3}"} ); // Row 1 (again, different obj.) createMap(result=>$attribute{rowA}); mapPut(map="$attribute{rowA}" key="foo" value="Other Obj: A - foo"); mapPut(map="$attribute{rowA}" key="bar" value="Other Obj: A - bar"); // Row 2 (again, different obj.) createMap(result=>$attribute{rowB}); mapPut(map="$attribute{rowB}" key="foo" value="Other Obj: B - foo"); mapPut(map="$attribute{rowB}" key="bar" value="Other Obj: B - bar"); // Row 3 (again, different obj.) createMap(result=>$attribute{rowC}); mapPut(map="$attribute{rowC}" key="foo" value="Other Obj: C - foo"); mapPut(map="$attribute{rowC}" key="bar" value="Other Obj: C - bar"); // Create List of Map (List of more rows) setAttribute(key='moreRows' value={"$attribute{rowA}" "${rowB}" "${rowC}"} ); createMap(result=>$attribute{rowSelected}); setAttribute(key="aSelectedVal" value=""); mapPut(map="$attribute{rowSelected}" key="aVal" value="#{aSelectedVal}"); setAttribute(key='selectedRows' value={"$attribute{rowSelected}"}); /> // NOTE: The {} on the outside of the ""'s create a List of the List(s) of rows $session{rowCount}); setAttribute(key="aSelectedVal" value="#{td.value.a}"); println(value="selected and put aVal: #{aSelectedVal}"); createMap(result=>$attribute{rowSelected}); mapPut(map="$attribute{rowSelected}" key="aVal$session{rowCount}" value="#{aSelectedVal}"); setAttribute(key='selectedRows' value={"$attribute{rowSelected}"}); dumpAttributes(value=>$attribute{allAttr}); println(value="$attribute{allAttr}"); /> >