在我的 Java EE Web 应用程序中,我将 DWR(Direct Web Remoting)用于 Ajax。
Java 类有许多 int 成员,可以通过 DWR 将其转换为 JavaScript 对象。例如:
// Java
public class MyClass {
private int id;
private String comments;
}
// the converted JavaScript class
var myObject = {
id: 100,
comments: "hello world"
}
但是,当我尝试将id等于null的js对象发送到应用服务器时,DWR报如下异常:
Erroring: batchId[7] message[org.directwebremoting.extend.MarshallException: Error marshalling int: Format error converting null. See the logs for more details.]
任何人都可以提供任何想法吗?