Step 1: Download 2.0 version of Spring form http://www.springframework.org/
Step 2: Download DWR version 2.0-rc2 from http://getahead.org/dwr/download
Copy spring and dwr jar files to the webapplication classpath.
Step 3: Add the below lines into web.xml
<servlet>
<servlet-name>dwr-spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dwr-spring</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>dwr-spring</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<!-- index page -->
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
Step 4: Create the default Spring MVC context file dwr-spring-servlet.xml under WEB-INF directory of the webapplication and configure the DWR
<?xml version="1.0"
encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.directwebremoting.org/schema/spring-dwrhttp://www.directwebremoting.org/schema/spring-dwr-2.0.xsd">
<!-- DWR CONFIGURATION --><dwr:configuration><dwr:create
javascript="JDate" type="new"class="java.util.Date" />
</dwr:configuration>
<dwr:controller id="dwrController" debug="true" />
<bean id="dwrHandlerMappings"class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="alwaysUseFullPath"
value="true" /><property
name="mappings"><props><prop key="/dwr/**/*">dwrController</prop></props></property></bean><!-- END OF DWR CONFIGURATION --></beans>
Step 5: Deploy the application in Tomcat 5.5 and point the browser to http://localhost:8080/dwr-spring/dwr/index.html
If the integartion is sucessfull it should display the page with JDate link on the page.
Blow links provides more information on how to integrate DWR and Srping
http://bram.jteam.nl/index.php/2007/01/
No comments:
Post a Comment