dwr出现error marshalling data,see the logs for more details问题_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > dwr出现error marshalling data,see the logs for more details问题

dwr出现error marshalling data,see the logs for more details问题

 2014/9/5 22:05:03  gu0600402203  程序员俱乐部  我要评论(0)
  • 摘要:js页面:varobj={};obj.id='11111';obj.address='sdfaf';obj.area=100.0;obj.unitprice=10000.0;obj.ispassed=true;transBuildingXController.saveTransBuildingX(obj,function(data){alert(data);})后台java的transBuildingXController方法
  • 标签:for logs all DWR 问题

js页面:

class="js">var obj = {};
obj.id='11111';
obj.address='sdfaf';
obj.area = 100.0;
obj.unitprice = 10000.0;
obj.ispassed = true;
transBuildingXController.saveTransBuildingX(obj,function(data){
	alert(data);
})

?

后台java的transBuildingXController方法:

public TransBuildingX saveTransBuildingX(TransBuildingX transBuilding)
{
    return transBuilding
}   

?

另外TransBuildingX的类:

public class TransBuildingX implements java.io.Serializable {
private String id;
private Double area;
 public String getId() {
        return this.id;
    }
    
    public void setId(String id) {
        this.id = id;
    }
    public Double getArea() {
        return this.area*100;
    }
    
    public void setArea(Double area) {
        this.area = area;
    }
}

??

这时用dwr提交时会出现错误“error marshalling data,see the logs for more details”
需要将Double改为double,或者将“return this.area*100;”改为“return this.area;

因为如果是Double时默认值为NULL,而double值时默认为0.0,而null*100会出错的。

发表评论
用户名: 匿名