求教有关DWR实现调用有JavaBean参数的java方法

Sunksubmarine 2008-05-29 08:40:20
dwr.xml如下:
<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN"
"http://getahead.org/dwr/dwr20.dtd">

<dwr>
<allow>
<create creator="new" javascript="Blbean">
<param name="class" value="bean.Blbean"/>
<include method="isUse"/>
<include method="getUser"/>
</create>
<convert converter="bean" match="bean.User">
<param name="include" value="username,password" />
</convert>
</allow>
</dwr>


JSP如下:
<script src='dwr/interface/Blbean.js'></script>
<script src='dwr/engine.js'></script>
<script src='dwr/util.js'></script>
......
function callExfun(){
var user;
user={username:"lingx",password:"123456"}
Blbean.printUser(user);
}

bean.Blbean 的printUser方法如下:
......
public void printUser(User user){
System.out.println(user.getUsername());
System.out.println(user.getUsername());
}

bean.User如下:
......
private String username;
private String password;
public User(String s1,String s2){
this.username = s1;
this.password = s2;
}
public String get......
public void set.....
......


JSP加载时控制台信息如下:(没有错误或者警告)
2008-5-29 8:35:59 org.directwebremoting.util.CommonsLoggingOutput info
信息: DWR Version 2.0.3 starting.
2008-5-29 8:35:59 org.directwebremoting.util.CommonsLoggingOutput info
信息: - Servlet Engine: Apache Tomcat/5.5.20
2008-5-29 8:35:59 org.directwebremoting.util.CommonsLoggingOutput info
信息: - Java Version: 1.5.0_04
2008-5-29 8:35:59 org.directwebremoting.util.CommonsLoggingOutput info
信息: - Java Vendor: Sun Microsystems Inc.
2008-5-29 8:36:00 org.directwebremoting.util.CommonsLoggingOutput info
信息: Probably not an issue: org.jdom.Document is not available so the jdom converter will not load. This is only an problem if you wanted to use it.
2008-5-29 8:36:00 org.directwebremoting.util.CommonsLoggingOutput info
信息: Probably not an issue: org.jdom.Element is not available so the jdom converter will not load. This is only an problem if you wanted to use it.

就是没有办法实现调用printUser方法,本人新学dwr望高人指正~
...全文
119 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
okey8 2008-05-29
  • 打赏
  • 举报
回复
function callExfun(){
var user;
user={username:"lingx",password:"123456"}
Blbean.printUser(user);
}

在dwr.xml 里面 找不到你所调用的 方法。。在 xml 里面也要定义
临远 2008-05-29
  • 打赏
  • 举报
回复
提示的信息没有问题哦
你给User类加一个空构造方法试试。

67,538

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧