2012-05-31 23 views
0

我正在嘗試將hdiv集成到grails 2.0.3應用程序中。grails hdiv集成 - 會話成功,但得到HDIV_PARAMETER_NOT_EXISTS異常

我已經在我的grails應用程序中爲spring mvc提供了hdiv-reference文檔中提到的所有更改。 當應用程序啓動時,我可以看到hdiv validatorfilter被初始化並創建了Hdiv會話。

任何幫助表示讚賞

巴拉

在我的applicationContext.xml我有

<bean id="requestDataValueProcessor" class="org.hdiv.web.servlet.support.HdivRequestDataValueProcessor" /> 

我的web.xml是

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="2.5" 
     metadata-complete="true" 
     xmlns="http://java.sun.com/xml/ns/javaee" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 

    <display-name>/@[email protected]</display-name> 

    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/applicationContext.xml,/WEB-INF/hdiv-config.xml,/WEB-INF/hdiv-validations.xml</param-value> 
    </context-param> 

    <context-param> 
     <param-name>webAppRootKey</param-name> 
     <param-value>@[email protected]</param-value> 
    </context-param> 

    <!-- HDIV Validator Filter --> 
    <filter> 
     <filter-name>ValidatorFilter</filter-name> 
     <filter-class>org.hdiv.filter.ValidatorFilter</filter-class> 
    </filter> 

    <filter> 
     <filter-name>sitemesh</filter-name> 
     <filter-class>org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter</filter-class> 
    </filter> 

    <filter> 
     <filter-name>charEncodingFilter</filter-name> 
     <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
     <init-param> 
      <param-name>targetBeanName</param-name> 
      <param-value>characterEncodingFilter</param-value> 
     </init-param> 
     <init-param> 
      <param-name>targetFilterLifecycle</param-name> 
      <param-value>true</param-value> 
     </init-param> 
    </filter> 

    <filter-mapping> 
     <filter-name>charEncodingFilter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 

    <filter-mapping> 
     <filter-name>sitemesh</filter-name> 
     <url-pattern>/*</url-pattern> 
     <dispatcher>REQUEST</dispatcher> 
     <dispatcher>ERROR</dispatcher> 
    </filter-mapping> 

    <filter-mapping> 
     <filter-name>ValidatorFilter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 


    <listener> 
     <listener-class>org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener</listener-class> 
    </listener> 

<!-- HDIV Listener class --> 
    <listener> 
     <listener-class>org.hdiv.listener.InitListener</listener-class> 
    </listener> 

    <!-- Grails dispatcher servlet --> 
    <servlet> 
     <servlet-name>grails</servlet-name> 
     <servlet-class>org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <!-- The Groovy Server Pages servlet --> 
    <servlet> 
     <servlet-name>gsp</servlet-name> 
     <servlet-class>org.codehaus.groovy.grails.web.pages.GroovyPagesServlet</servlet-class> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>gsp</servlet-name> 
     <url-pattern>*.gsp</url-pattern> 
    </servlet-mapping> 

    <welcome-file-list> 
     <!-- 
     The order of the welcome pages is important. JBoss deployment will 
     break if index.gsp is first in the list. 
     --> 
     <welcome-file>index.html</welcome-file> 
     <welcome-file>index.jsp</welcome-file> 
     <welcome-file>index.gsp</welcome-file> 
    </welcome-file-list> 

    <jsp-config> 
     <taglib> 
      <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri> 
      <taglib-location>/WEB-INF/tld/c.tld</taglib-location> 
     </taglib> 
     <taglib> 
      <taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri> 
      <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location> 
     </taglib> 
     <taglib> 
      <taglib-uri>http://www.springframework.org/tags</taglib-uri> 
      <taglib-location>/WEB-INF/tld/spring.tld</taglib-location> 
     </taglib> 

     <taglib> 
        <taglib-uri>http://grails.codehaus.org/tags</taglib-uri> 
        <taglib-location>/WEB-INF/tld/grails.tld</taglib-location> 
       </taglib>   
     <taglib> 
      <taglib-uri>http://www.springframework.org/tags/form</taglib-uri> 
      <taglib-location>/WEB-INF/tld/spring-form.tld</taglib-location> 
     </taglib> 
    </jsp-config> 

</web-app> 

我HDIV-config.xml中是

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hdiv="http://www.hdiv.org/schema/hdiv" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
http://www.hdiv.org/schema/hdiv http://www.hdiv.org/schema/hdiv/hdiv.xsd"> 

    <hdiv:config errorPage="/error.jsp"> 
     <hdiv:startPages>/,/attacks/.*,/index.gsp</hdiv:startPages> 
    </hdiv:config> 

</beans> 

不過,我看到一個錯誤

2012-05-31 15:10:22,704 [pool-5-thread-1] DEBUG filter.ValidatorFilter - Initializing filter 'ValidatorFilter' 
    2012-05-31 15:10:22,705 [pool-5-thread-1] DEBUG filter.ValidatorFilter - Filter 'ValidatorFilter' configured successfully 
| Server running. 
2012-05-31 15:10:32,912 [http-bio-8080-exec-2] INFO listener.InitListener - HDIV's session created:39414F37F6E68615298D1B7B6FD4B3A0 
2012-05-31 15:10:32,925 [http-bio-8080-exec-2] INFO **logs.Logger - HDIV_PARAMETER_NOT_EXISTS;/TestHdiv/author/index;_HDIV_STATE_;null;0:0:0:0:0:0:0:1;0:0:0:0:0:0:0:1;user** 
2012-05-31 15:10:32,925 [http-bio-8080-exec-2] DEBUG dataComposer.DataComposerMemory - The page [14] has no states, is not stored in session 
2012-05-31 15:10:32,985 [http-bio-8080-exec-3] DEBUG dataComposer.DataComposerMemory - The page [15] has no states, is not stored in session 

回答

0

installation documentation對於HDIV也許試試這個:

<filter-mapping> 
    <filter-name>ValidatorFilter</filter-name> 
    <!-- Grails dispatcher servlet --> 
    <servlet-name>grails</servlet-name> 
</filter-mapping> 

您可能還需要添加GSP servlet映射,但是我會盡量只用Grails的前端控制器第一。

<filter-mapping> 
    <filter-name>ValidatorFilter</filter-name> 
    <!-- Grails dispatcher servlet --> 
    <servlet-name>grails</servlet-name> 
    <!-- Groovy Server Pages servlet --> 
    <servlet-name>gsp</servlet-name> 
</filter-mapping>