DWR Annotations
DWR annotations can be used as a replacement as well as in conjunction with dwr.xml
.
Annotation support was written by Maik Schreiber.
Setup
To use DWR with annotations you need to specify a different DWR controller servlet in your web.xml
:
<servlet>
<description>DWR controller servlet</description>
<servlet-name>DWR controller servlet</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>classes</param-name>
<param-value>
com.example.RemoteFunctions,
com.example.RemoteBean
</param-value>
</init-param>
</servlet>
The classes
servlet parameter must provide a comma-separated list of the fully-qualified class names of all annotated classes to be used with DWR.
The syntax for inner classes is to use '$' notation (as used by Class.forName()) rather than '.' notation (as used by import statements). For example, use java.util.Map$Entry
and not java.util.Map.Entry
.
Remote Class Access
To make a simple class available for remote access, use the @Create
and @RemoteMethod
annotations:
@RemoteProxy
public class RemoteFunctions {
@RemoteMethod
public int calculateFoo() {
return 42;
}
}
Any method not annotated with @RemoteMethod
will not be available for remote access.
To use a scripting name different from the class name, use the name
attribute of @RemoteProxy
:
@RemoteProxy(name="Functions")
public class RemoteFunctions {
}
Object Conversion
To make simple bean classes available for remote access, use the @DataTransferObject
and @RemoteProperty
annotations:
@DataTransferObject
public class Foo {
@RemoteProperty
private int foo;
public int getFoo() {
return foo;
}
@RemoteProperty
public int getBar() {
return foo * 42;
}
}
To use more sophisticated converters see the converter
attribute of the @DataTransferObject
annotation.
分享到:
相关推荐
配置整合DWR3.0和Spring2.5使用annotation注解
dwr框架在项目中的使用, 一个sprig3+dwr3+jpa+struts2,基于注解的完整demo 一个sprig2+dwr2+hibernate3+struts1,基于配置文件的完整demo http://blog.csdn.net/zuxianghuang/article/details/7376247
Dwr3+Spring3 全注解 annotation 方式实现
该文件中包括了dwr框架和spring框架结合使用方法,使用注解方式。
spring使用annotation整合dwr笔记 spring使用annotation整合dwr笔记 spring使用annotation整合dwr笔记
NULL 博文链接:https://medbricom.iteye.com/blog/1186774
struts2.1 spring2.5 ibatis2.3 dwr3 annotation配置 集成 此中例子不完整. 如要下载:http://download.csdn.net/source/2138885
DWR使用步骤DWR使用步骤DWR使用步骤DWR使用步骤DWR使用步骤DWR使用步骤DWR使用步骤DWR使用步骤DWR使用步骤DWR使用步骤DWR使用步骤DWR使用步骤
spring2.5 ibatis2.3 struts2.1 dwr3 annotation集成配置
使用注解整合ext dwr spring hibernate
DWR.xml配置文件说明.doc
DWR 框架使用手册DWR 框架使用手册DWR 框架使用手册DWR 框架使用手册DWR 框架使用手册DWR 框架使用手册
dwr 框架dwr 框架dwr 框架dwr 框架dwr 框架dwr 框架
NULL 博文链接:https://j4t.iteye.com/blog/1562162
自己总结的一个的dwr的使用说明,附有源码,以及代码的详细解释,配置文件的详细解释。完全可以运行。同时介绍了与其类似用法的dotnet版本的ajax组建。需要自己下载dwr.jar 3.0版本。或者到我的空间下载dwr.jar 3.0...
dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;dwr包;
dwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwrdwr dwr
将dwr集成到spring mvc(dwr的配置是基于xml)
配置和使用DWR进行Ajax开发
springMvc + dwr 注解 实现消息推送 ,支持单个用户精确推送以及指定成员.群推送. 不需要任何配置修改,即可使用