开发者

not able to get a proper hashmap for a DWR call

I am trying to pass a string of data which is a hashmap from a javascript to a java function by making an Ajax DWR call as below:

var str11 = {
             "78965":{"age":"34yrs","height":"4"},
             "44589":{"age": "32yrs", "height": "99yrs"}
            };

person= 233453;

Person.saveSelected(planOid,
        开发者_StackOverflow社区            str11,
                    {
                     callback:savedValues,
                     errorHandler:handleError
                    }
                   );

But at the other end in my Java class i.e PersonService.java, I receive both of the params successfully but when I examine the hashmap it takes the form as below:

{
 44589={age:reference:c0-e5, height:reference:c0-e6}, 
 78965={age:reference:c0-e2, height:reference:c0-e3}
}   

I am not able to understand why the the references. Instead I am expecting a proper hashMap . Can any one sort out what the problem is with DWR marshaling behind the scenes?


Map<String, Object> is not specific enough for DWR to know which object to instantiate. So you will have to use Map<String, YourConcreteClass> (a collection in you case).

This means that you cannot use different types for values in your map (which shouldn't be problem in your case).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜