HDIV始终重定向到errorpage,错误为HDIV_PARAMETER_NOT_EXISTS

时间:2014-03-18 04:45:42

标签: java spring spring-security hdiv

我正在尝试将HDIV实现到spring 3.1应用程序。

我已经在pom文件和监听器中添加了依赖项,在web.xml文件中进行了过滤。

我已经完成了所示的配置,当我访问应用程序时,欢迎页面正在加载,但之后如果我从屏幕访问任何链接,那么它将被重定向到errorpage。

我收到的错误是" HDIV_PARAMETER_NOT_EXISTS"

可能是什么问题?

如何在请求中发送HDIV参数。我是否需要修改JSP以在请求中发送HDIV参数?

的web.xml:

     <listener>
    <listener-class>org.hdiv.listener.InitListener</listener-class>
    </listener>
<!-- HDIV Validator Filter -->
<filter>
    <filter-name>ValidatorFilter</filter-name>
    <filter-class>org.hdiv.filter.ValidatorFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>ValidatorFilter</filter-name>
    <!-- Spring MVC Servlet name-->
    <servlet-name>mvc-dispatcher</servlet-name>
</filter-mapping>


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

的pom.xml:

<dependency>
          <groupId>org.hdiv</groupId>
          <artifactId>hdiv-core</artifactId>
      <version>${org.hdiv-version}</version>
</dependency>
<dependency>
    <groupId>org.hdiv</groupId>
    <artifactId>hdiv-config</artifactId>
    <version>${org.hdiv-version}</version>
</dependency>
<dependency>
    <groupId>org.hdiv</groupId>
    <artifactId>hdiv-spring-mvc</artifactId>
    <version>${org.hdiv-version}</version>
    </dependency>
<dependency>
    <groupId>org.hdiv</groupId>
    <artifactId>hdiv-jstl-taglibs-1.2</artifactId>
    <version>${org.hdiv-version}</version>
</dependency>

配置:

<hdiv:config excludedExtensions="css,png,gif,jpeg,jpg,js" errorPage="/errorPage.jsp">
<hdiv:startPages>/,/index.htm</hdiv:startPages>
</hdiv:config> 

<!-- Accepted pattern within the application for all editable parameters (generated from textbox and textarea) -->   
<hdiv:validation id="safeText">         
<hdiv:acceptedPattern><![CDATA[^[a-zA-Z0-9@.-_]*$]]></hdiv:acceptedPattern>     
</hdiv:validation>       
<!-- Finally, it's necessary to define editable data validation for the application -->    
<hdiv:editableValidations>         
<hdiv:validationRule url="/.*">safeText</hdiv:validationRule>     
</hdiv:editableValidations>

的index.jsp:

        <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    <html>
      <head>
      <title>Freight Management Tool</title>
      </head>
      <body  topmargin="0" leftmargin="0" >


    <div id="header">
        <%@include file="header.jspf"%>  
    </div> 
    <div id="content"> </div>
        <table width="100%" cellpadding="0" cellspacing="0" border="0">
            <tr class="topHeading">
                <td>
                <% if (request.isUserInRole("FMT_ADMIN")) { %>
                    <spring:message code = "index.admin"/>
                <% } if (request.isUserInRole("FMT_NM")) { %>
                    <spring:message code = "index.network.mngt"/>
                <% } if (request.isUserInRole("FMT_RM")) { %>
                    <spring:message code = "index.revenue.mngt"/>
                <% } if (request.isUserInRole("FMT_SALES")) { %>
                    <spring:message code = "index.sales"/>
                <% } %>
                </td>
                <td></td>
            </tr>
        </table>
        <table width="100%" cellpadding="0" cellspacing="0" border="0">
            <br/>
            <% if (!request.isUserInRole("FMT_SALES")) { %>
            <tr>
                <td width="2%"></td>
                <td width="15%" class="blackHeading"><spring:message code = "index.welcome"/> <h1><a href="/cargoalflights/SearchCargoalFlightMaster.htm"><spring:message code = "index.cargoal.search"/></a></h1></td>
                <td width="63%"></td>
            </tr>
            <% } else {%>
            <tr>
                <td width="2%"></td>
                <td width="15%" class="blackHeading"><spring:message code = "index.welcome"/> <h1><a href="/datedflight/DatedFlightSearch.htm"><spring:message code = "index.dated.flight.search"/></a></h1></td>
                <td width="63%"></td>
            </tr>
            <% } %>

        </table>

  </body>
</html>

DatedFlightController.java:

@RequestMapping("/datedflight/DatedFlightSearch.htm")
public ModelAndView datedFlightSearchScreen() {
return new ModelAndView("datedFlightSearch", "datedFlightDTO",
            datedFlightDTO);
}

1 个答案:

答案 0 :(得分:0)

您必须使用JSTL或Spring标记来创建URL:

<c:url value="/datedflight/DatedFlightSearch.htm">

<spring:url value="/datedflight/DatedFlightSearch.htm">

否则,HDIV不能将状态识别作为参数包括在内。