DWR2.03错误问题(菜鸟级),高手请指点下!
今天第一次尝试dwr,做了一个简单的例子,遇到了这样一个问题:May 21, 2008 3:49:38 PM org.directwebremoting.util.CommonsLoggingOutput info
INFO: Exec: service.sayHello()
具体代码如下:
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<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://getahead.org/dwr/dwr20.dtd">
<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.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<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>
希望高手指点下!谢谢!
----------------解决方案--------------------------------------------------------
回复 1# 的帖子
我还没有学习这方面的技术,不过javaeye好像有些相关的知识。
整理的DWR学习笔记
http://www.javaeye.com/topic/32782
----------------解决方案--------------------------------------------------------
我这边有个dwr的简单例子 如果你需要把邮箱留下
----------------解决方案--------------------------------------------------------
dwr不爽。。。。出错了找都不好找。。。。
----------------解决方案--------------------------------------------------------
是啊,老郁闷了,唉
----------------解决方案--------------------------------------------------------