dwr.xml
<dwr>
<allow>
<create creator="new" javascript="menu">
<param name="class" value="com.ssdb.dwr.Menu"/>
</create>
<create creator="new" javascript="dian">
<param name="class" value="com.ssdb.dwr.Dian"/>
</create>
<create creator="new" javascript="xml">
<param name="class" value="com.ssdb.dwr.Xml"/>
</create>
</allow>
</dwr>
web.xml
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>
org.directwebremoting.servlet.DwrServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>activeReverseAjaxEnabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>
initApplicationScopeCreatorsAtStartup
</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>maxWaitAfterWrite</param-name>
<param-value>500</param-value>
</init-param>
<init-param>
<param-name>crossDomainSessionSecurity</param-name>
<param-value>false</param-value>
</init-param>
<!-- crossDomainSession Security 设置成false使能够从其他域进行请求。注意,这样做会在安全性上有点冒险,在没有理解这个后果前不要设置成为false。-->
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
xxx.html
<script type='text/javascript' src='<%=path%>/dwr/engine.js'> </script>
<script type='text/javascript' src='<%=path%>/dwr/util.js'> </script>
<script type='text/javascript' src='<%=path%>/dwr/interface/kucunModel.js'> </script>
DWREngine.setAsync(false);//关闭异步
(因为在dwr3.x版本的engine.js中已经取消了DWREngine的定义,<记得多看源码呀!>)
最后,把 DWREngine 改为 dwr.engine ,试试即可知道该方法是否有效了
//样例
xml.getGuangGaoXml(url,function(value){
if(value.length>0)
{
// ..
}else{
/ /..
}
});
//这里我没有用到bean