bl双性强迫侵犯h_国产在线观看人成激情视频_蜜芽188_被诱拐的少孩全彩啪啪漫画

解決springmvc關于前臺日期作為實體類對象參數類型轉換錯誤的問題-創新互聯

頁面報錯:

成都創新互聯堅持“要么做到,要么別承諾”的工作理念,服務領域包括:成都網站建設、成都網站制作、企業官網、英文網站、手機端網站、網站推廣等服務,滿足客戶于互聯網時代的秦都網站設計、移動媒體設計的需求,幫助企業找到有效的互聯網解決方案。努力成為您成熟可靠的網絡建設合作伙伴!

后臺錯誤:

Field error in object 'user' on field 'birthday': rejected value [2013-06-24]; codes [typeMismatch.user.birthday,typeMismatch.birthday,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [user.birthday,birthday]; arguments []; default message [birthday]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'birthday'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type java.util.Date for value '2013-06-24'; nested exception is java.lang.IllegalArgumentException]

解決方案1:在對應的實體類屬性上加入 @DateTimeFormat(pattern = "yyyy-MM-dd")

解決方案2:不使用 <mvc:annotation-driven/>注解

使用 DefaultAnnotationHandlerMapping 和 AnnotationMethodHandlerAdapter 注解驅動配置

在對應的實體類屬性上加入 @DateTimeFormat(pattern = "yyyy-MM-dd")

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
      <property name="webBindingInitializer">
        <bean class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer">
          <property name="conversionService">
            <bean class="org.springframework.format.support.FormattingConversionServiceFactoryBean"/>
          </property>
        </bean>
      </property>
    </bean>

網頁題目:解決springmvc關于前臺日期作為實體類對象參數類型轉換錯誤的問題-創新互聯
分享網址:http://vcdvsql.cn/article24/ddjdje.html

成都網站建設公司_創新互聯,為您提供全網營銷推廣品牌網站設計域名注冊網站制作網站導航網站設計公司

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

網站優化排名