| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 730 人关注过本帖
标题:DWR2.03错误问题(菜鸟级),高手请指点下!
取消只看楼主 加入收藏
lnyy1019
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2008-4-16
收藏
 问题点数:0 回复次数:1 
DWR2.03错误问题(菜鸟级),高手请指点下!
今天第一次尝试dwr,做了一个简单的例子,遇到了这样一个问题:
May 21, 2008 3:49:38 PM org.directwebremoting. info
INFO: Exec: service.sayHello()
具体代码如下:
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
    xmlns="http://java.
    xmlns:xsi="http://www.
    xsi:schemaLocation="http://java.
    http://java.
    
      <servlet>
    <servlet-name>dwr-invoker</servlet-name>
    <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
    <init-param>
      <param-name>debug</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>   
            <param-name>crossDomainSessionSecurity</param-name>   
            <param-value>false</param-value>   
    </init-param>
   
    <load-on-startup>3</load-on-startup>
  </servlet>
   <servlet-mapping>
    <servlet-name>dwr-invoker</servlet-name>
    <url-pattern>/dwr/*</url-pattern>
  </servlet-mapping>
</web-app>
dwr.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN" "http://

<dwr>
  <allow>
      <create javascript="service" creator="new">
      <param name="class" value="helloWorld.Service"></param>
      </create>
  </allow>
</dwr>
java :
package helloWorld;

public class Service {
    public String sayHello(String yourname){
        return "Hello World:"+yourname;
    }
}
jsp:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<% String contextPath = request.getContextPath(); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>MyFirst_Dwr</title>
<script language="javascript" src="js/engine.js"></script>
<script language="javascript" src="js/util.js"></script>
<script language="javascript" src="<%=contextPath%>/dwr/interface/service.js"></script>
<script language="javascript">
function firstDwr(){
service.sayHello("cuizhouyang",callBackHello);
}
function callBackHello(data){
alert(data);
}

</script>
</head>

<body>
<label>
<input type="button" name="button" value="测试" onclick="firstDwr()"/>
</label>
</body>
</html>
希望高手指点下!谢谢!
2008-05-21 16:00
lnyy1019
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2008-4-16
收藏
得分:0 
是啊,老郁闷了,唉
2008-05-27 14:07
快速回复:DWR2.03错误问题(菜鸟级),高手请指点下!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029527 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved