程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> spring mvc-springmvc寫的畢業設計,然後出現重復請求的現象,確認不是浏覽器問題

spring mvc-springmvc寫的畢業設計,然後出現重復請求的現象,確認不是浏覽器問題

編輯:編程解疑
springmvc寫的畢業設計,然後出現重復請求的現象,確認不是浏覽器問題

如下圖,紅框中的地址首頁地址,重復請求**三次以上**,次數不確定。求大神幫忙
圖片說明
下面貼上web.xml和springmvc的配置

springmvc.xml


    <!-- 容器默認的DefaultServletHandler處理 所有靜態內容與無RequestMapping處理的URL -->
    <mvc:default-servlet-handler />

<!--    <import resource="applicationContext.xml" /> -->
    <context:annotation-config />
    <!-- 對web包中的所有類進行掃描,以完成bean的創建和自動依賴注入功能 -->
    <context:component-scan base-package="com.junzhong"  >
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" /> 
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service" /> 
    </context:component-scan>
    <mvc:annotation-driven />


    <!-- 定義無需Controller的url<->view直接映射 -->
<!--    <mvc:view-controller path="/" view-name="redirect:/main/index" /> -->


    <!-- 對模型視圖的名稱的解析 -->
    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass"
            value="org.springframework.web.servlet.view.JstlView"></property>
        <!-- 指定了表示層的前綴 這個配置是配置JSP頁面的位置,按照你自己的配置來配 -->
        <property name="prefix" value="/WEB-INF/page/"></property>
        <!-- 指定了表示層的後綴 -->
        <property name="suffix" value=".jsp"></property>
    </bean>

    <bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <!--one of the properties available;the maximum upload size in bytes 100M -->
        <property value="104857600" name="maxUploadSize" />
    </bean>


web.xml

 <welcome-file-list>
        <welcome-file>main/index</welcome-file>
    </welcome-file-list>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:spring/*.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <filter>
        <filter-name>encodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>encodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <!-- spring-session -->
    <filter>
        <filter-name>spring-session</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        <init-param>
            <param-name>targetBeanName</param-name>
            <param-value>springsession</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>spring-session</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <listener>
        <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>
    <session-config>
        <session-timeout>1440</session-timeout>
    </session-config>

    <servlet>
        <servlet-name>wuhuan-frontend</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:spring/springmvc.xml</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>wuhuan-frontend</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>


    <!-- socket的映射 -->
    <!-- <servlet-mapping> -->
    <!-- <servlet-name>wuhuan</servlet-name> -->
    <!-- <url-pattern>/socketMsg/*</url-pattern> -->
    <!-- </servlet-mapping> -->
    <!-- <servlet-mapping> -->
    <!-- <servlet-name>wuhuan</servlet-name> -->
    <!-- <url-pattern>/socketMsg/sockjs/*</url-pattern> -->
    <!-- </servlet-mapping> -->


    <error-page>
        <exception-type>java.lang.Throwable</exception-type>
        <location>/common/500.jsp</location>
    </error-page>
    <error-page>
        <error-code>500</error-code>
        <location>/common/500.jsp</location>
    </error-page>
    <error-page>
        <error-code>404</error-code>
        <location>/common/404.jsp</location>
    </error-page>
    <error-page>
        <error-code>403</error-code>
        <location>/common/403.jsp</location>
    </error-page>

最佳回答:


自己最後解決了,原因是我之前有圖片沒有弄上,用#號代替的,結果它也進行網絡請求了

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved