标签:nbsp jsp not web.xml framework attribute ext sources default
@RemoteProxy()注释
dwr3.0可以通过全注解的方式,极大的简化了配置,所有xml配置加在一起不超过20行,而且使用更加简单,bean注入的问题也都解决。配置步骤如下:
web.xml的配置文件中,在默认的DispatcherServlet的mapping里加上dwr
dispatcherServlet的配置文件appServlet-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd">
<!-- DispatcherServlet Context: defines this servlet‘s request-processing
infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving
up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<interceptors>
<beans:bean class="com.panguso.op.data.manager.interceptor.LogInterceptor"></beans:bean>
</interceptors>
<!-- Resolves views selected for rendering by @Controllers to .jsp resources
in the /WEB-INF/views directory -->
<beans:bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<!--<view-controller path="/" view-name="index" /> -->
<context:component-scan base-package="com.panguso.op.data.manager" />
<!-- 从这行往下是要添加的 -->
<context:annotation-config />
<dwr:configuration />
<dwr:annotation-config />
<dwr:url-mapping />
<dwr:controller id="dwrController" debug="true">
<dwr:config-param name="allowScriptTagRemoting"
value="true" />
<dwr:config-param name="crossDomainSessionSecurity"
value="false" />
</dwr:controller>
<beans:bean
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<beans:property name="order" value="1" />
</beans:bean>
<beans:bean
class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
<beans:property name="order" value="2" />
</beans:bean>
<!--添加结束-->
</beans:beans>
配置完毕,使用的方法和上文类似,注意的是@RemoteProxy标注的远程类一定要加上name属性,不然启动会报错,如:
@Service
@RemoteProxy(name = "GeneralContentManagementService")
public class GeneralContentManagementService {
@RemoteMethod
public void aaa()
{
}
}
标签:nbsp jsp not web.xml framework attribute ext sources default
原文地址:http://www.cnblogs.com/hpj1038361347/p/6956011.html