dwr.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
        "http://www.getahead.ltd.uk/dwr/dwr10.dtd"
>
<dwr>
    
<allow>
        
<create creator="spring" javascript="UserDAO">
            
<param name="beanName" value="userDao"/>
            
<include method="addUser"/>
            
<include method="removeUser"/>
            
<include method="findUserByName"/>
        
</create>

        
<convert converter="bean" match="martin.dwr.demo.model.User">
            
<param name="include" value="id,name,password,age"/>
        
</convert>

    
</allow>
</dwr>

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd"
>
<web-app>

    
<context-param>
        
<param-name>contextConfigLocation</param-name>
        
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
    
</context-param>

    
<listener>
        
<listener-class>
            org.springframework.web.context.ContextLoaderListener
        
</listener-class>
    
</listener>

    
<servlet>
        
<servlet-name>dwr-invoker</servlet-name>
        
<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
        
<init-param>
            
<param-name>debug</param-name>
            
<param-value>true</param-value>
        
</init-param>
        
<init-param>
            
<param-name>config-admin</param-name>
            
<param-value>WEB-INF/classes/dwr.xml</param-value>
        
</init-param>
    
</servlet>

    
<servlet-mapping>
        
<servlet-name>dwr-invoker</servlet-name>
        
<url-pattern>/dwr/*</url-pattern>
    
</servlet-mapping>
</web-app>

applicationContext.xml
    <bean id="userDao" class="martin.dwr.demo.dao.hibernate.HibernateUserDAO">
        
<property name="sessionFactory" ref="sessionFactory"/>
    
</bean>

浏览:http://localhost:8080/demo/dwr/index.html 查看调试信息
分享到:
评论