spring and DWR mapping problems -
i have problem spring mvc mapping when integrated dwr. problem that, can't them worked together. want use dwr service in jsp, when dwr mapping works spring doesn't , opposite.
web.xml
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>spring mvc application</display-name> <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/dwr/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <listener> <listener-class> springlisteners.mysessionlistener </listener-class> </listener> <session-config> <session-timeout>1</session-timeout> </session-config> </web-app>
mvc-dispatcher-servler.xml
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr/spring-dwr-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <context:component-scan base-package="com.springapp.mvc"/> <bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix" value="/web-inf/pages/"/> <property name="suffix" value=".jsp"/> </bean> <dwr:controller id="dwrcontroller" debug="true"> <dwr:config-param name="activereverseajaxenabled" value="true"/> <dwr:config-param name="scriptcompressed" value="true"/> <dwr:config-param name="fileuploadmaxbytes" value="10485760"/> <dwr:config-param name="allowscripttagremoting" value="true"/> </dwr:controller> <bean class="org.springframework.web.servlet.handler.simpleurlhandlermapping"> <property name="alwaysusefullpath" value="true"/> <property name="mappings"> <props> <prop key="/dwr/**/*">dwrcontroller</prop> </props> </property> </bean> <bean id="player" class="dwr.player" scope="session"> <dwr:remote javascript="player"> <!--<dwr:include method="" />--> </dwr:remote> <aop:scoped-proxy proxy-target-class="false"/> </bean> </beans>
now dwr works in debug mode other spring mappings don't. when remove
<bean class="org.springframework.web.servlet.handler.simpleurlhandlermapping"> <property name="alwaysusefullpath" value="true"/> <property name="mappings"> <props> <prop key="/dwr/**/*">dwrcontroller</prop> </props> </property> </bean>
dwr doesn't work, spring mappings do. controller use testing spring mappings
@controller @requestmapping("/") public class hellocontroller { @requestmapping(method = requestmethod.get) public string printwelcome(modelmap model) { system.out.println("agaga"); model.addattribute("message", "hello world!"); return "hello"; } }
Comments
Post a Comment