读书人

配备一个最简洁的DWR

发布时间: 2012-12-27 10:17:10 作者: rapoo

配置一个最简洁的DWR

期工作:

1.dwr官网下载dwr.jar(http://directwebremoting.org/dwr/downloads/index.html)

2.将dwr.jar放在自己的lib目录下(同时引入commons-logging.jar,可能适合dwr记录日志有关系,在下边的zip中lib目录中可以找到)。

3.编辑web.xml,加入如下代码:

?

6 测试dwr是否配置成功http://localhost:8080/webapp名称/dwr/index.html

例如我的:http://localhost:8080/emss/dwr/index.html,

如果页面出现

Classes known to DWR:Test (com.Test)

:字样,恭喜你,dwr配置成功了。

点击Test,进入dwr调试页面,从页面可以看到当前Test的配置信息为(这些信息是需要引入到jsp页面的):

<!-- These paths use .. so that they still work behind a path mapping proxy. The fully qualified version is more cut and paste friendly. -->

Methods For: Test (com.Test)

To use this class in your javascript you will need the following script includes:

  <script type='text/javascript' src='/emss/dwr/interface/Test.js'></script>  <script type='text/javascript' src='/emss/dwr/engine.js'></script>

In addition there is an optional utility script:

  <script type='text/javascript' src='/emss/dwr/util.js'></script>

?

?

7 jsp页面引用:

?

?

8 特别注意: 在使用dwr的时候必须引入commons-logging.jar

?

9 结束。

?

?

?

?

?

读书人网 >编程

热点推荐