浏览 11042 次
该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2008-03-30
tomcat 打印如下信息: 2008-03-30 21:49:22,281 [org.directwebremoting.dwrp.DefaultConverterManager]-[ERROR] No converter found for 'org.zm.dwr.Item' [org.directwebremoting.dwrp.DefaultConverterManager]-[ERROR] No converter found for 'org.zm.dwr.Item' 2008-03-30 21:49:22,296 [org.directwebremoting.dwrp.DefaultConverterManager]-[ERROR] No converter found for 'org.zm.dwr.Item' --我的jsp和javascript文件 <script type="text/javascript" src="/DwrTest/dwr/interface/shopping.js"></script> <script type="text/javascript" src="/DwrTest/dwr/engine.js"></script> <script type="text/javascript" src="/DwrTest/dwr/util.js"></script> <script type="text/javascript"> window.onload = function(){ shopping.getList(displayItems); } function displayItems(items){ DWRUtil.removeAllRows("content") ; //先移除table数据 if(items.length!=0){alert(items.length);} //运行时 提示长度为 3 DWRUtil.addRows("content",items,cellFunctions); //填充table } var cellFunctions=[ function(item){ return item.name;}, function(Item){ return item.description;}, function(item){ return item.price;}, function(item){ var btn = document.createElement("button"); btn.innerHtml="add" ; return btn ; } </script> </head> <body> <table> <tbody id="content"> <!-- 在此填充数据 --> </tbody> </table> </body> ---DBFactory 类 :我的数据工厂类package org.zm.dwr; import java.util.HashMap; import java.util.Map; public class DBFactory { private static Map<String ,Item> allItems= new HashMap<String,Item>() ; static{ allItems.put("1111", new Item("aaaaa","bbbbbb","ccccc",1999)); allItems.put("2222", new Item("acdfdf","sdfsdf","sdaffsdaf",1129)); allItems.put("33333", new Item("234dsd","vsadsdf","234sdsdf",1542)); } public static Map getAllItems(){ return allItems ; } } ---DAO类 package org.zm.dwr; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class ShoppingDAO extends DBFactory { @SuppressWarnings("unchecked") public List getList(){ ArrayList<Item> list = new ArrayList<Item>() ; Iterator<Item> i = getAllItems().values().iterator(); while(i.hasNext()){ Item item = i.next() ; list.add(item); System.out.println(item.getName()); } return list ; } } ----javabean package org.zm.dwr; public class Item{ private String id; private String name; private String description; private int price; public Item(String id, String name, String description, int price) { this.id = id; this.name = name; this.description = description; this.price = price; } public String getDescription() { return description; } public String getId() { return id; } public String getName() { return name; } public int getPrice() { return price; } } --我的dwr.xml : <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN" "http://getahead.org/dwr/dwr20.dtd"> <dwr> <allow> <create javascript="shopping" creator="new" scope="session"> <param name="class" value="org.zm.dwr.ShoppingDAO"></param> <include method="getList"/> </create> <convert match="bean" converter="org.zm.dwr.Item"></convert></allow> </dwr> 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2008-04-02
There is no converter for your class org.zm.dwr.Item
Pls read the doc about dwr.xml |
|
返回顶楼 | |
发表时间:2008-05-25
javabean 没有setter方法,光有getter方法。我是这么认为的,不知道对不对
|
|
返回顶楼 | |
发表时间:2008-05-25
dwr会害死人的
|
|
返回顶楼 | |
发表时间:2008-05-27
<convert match="bean" converter="org.zm.dwr.Item"></convert></allow>
写错了,应该是<convert converter="bean" match="org.zm.dwr.Item"></convert></allow> |
|
返回顶楼 | |
发表时间:2008-06-02
同样的问题,郁闷,找原因不到
|
|
返回顶楼 | |
发表时间:2008-06-26
我也遇到同样的问题啊,用dwr/debug得到的结果是[null,null]?
|
|
返回顶楼 | |