我正在使用 dwr 发送和获取一些信息,但我收到以下错误。
service(DwrSampleTest) is not defined
当我尝试使用以下行查看文件时:
http://localhost:8080/Servlets-DWR/dwr/index.html
我得到以下异常:Access to debug pages is denied.
这是我的 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 creator="new" javascript="Dwrsample">
<param name="class" value="com.dwrsample.servlet.DwrSampleTest"/>
</create>
</allow>
</dwr>
网页.xml:
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>crossDomainSessionSecurity</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>DwrsampleServlet</servlet-name>
<servlet-class>com.dwrsample.servlet.DwrsampleServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
以及我调用该方法的文件:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>DWR Sample</title>
<script src='dwr/dwr/engine.js'></script>
<script src='dwr/dwr/util.js'></script>
<script src='dwr/dwr/interface/DwrSampleTest.js'></script>
<script>
function getName() {
DwrSampleTest.getName({callback:setName,async:false});
}
function setName(strName) {
document.getElementById("enterdwr").value = "";
document.getElementById("enterdwr").value = strName;
}
</script>
</head>
<body>
<h1>DWR Sample Test!</h1>
<form method="post" name="dwrsample" id="dwrsample">
<table>
<tr class="lightrow">
<td width="1%">*</td>
<td width="39%">Eenter DWR</td>
<td width="60%"><input name="enterdwr" id="password" type="text" onblur="getName()"/></td>
</tr>
<tr class="lightrow">
<td width="1%">*</td>
<td width="39%">DWR Result</td>
<td width="60%"><input name="resultdwr" id="password" type="text" /></td>
</tr>
</table>
</form>
</body>
</html>
请帮我解决这个问题。