spring mvc Failed to convert property value of type java.lang.String to required

问题描述

在使用springmvc的时候,遇到一个非常痛苦的问题:Failedtoconvertpropertyvalueoftypejava.lang.Stringtorequiredtypejava.lang.Integerforpropertyorder;nestedexceptionisjava.lang.NumberFormatException:Forinputstring:"sadfas"errors.requiredgoogle了一大把,也照别人说的做了,添加protectedvoidinitBinder(HttpServletRequestrequest,ServletRequestDataBinderbinder)throwsException{binder.registerCustomEditor(Integer.class,null,newIntegerPropertiesEditor());super.initBinder(request,binder);}IntegerPropertiesEditor是我自定义的,行不通,不自定义的也行不通,binder.registerCustomEditor(Integer.class,null,newCustomNumberEditor(Integer.class,true));这到底是怎么回事!

时间: 2024-08-02 00:08:41

spring mvc Failed to convert property value of type java.lang.String to required的相关文章

Cannot convert value of type [java.lang.String] to required type [java.util.Date] for property 'xxx': no matching editors or conversion strategy found

今天在完成项目的时候遇到了下面的异常信息: 04-Aug-2014 15:49:27.894 SEVERE [http-apr-8080-exec-5] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [cms] in context with path [/cms] threw exception [Request processing failed; nested excep

Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String'

一.发现问题 <select id="queryStudentByNum" resultType="student" parameterType="string">   select num,name,phone from student  <where> <if test = " num!=null and num!='' ">AND num = #{num}</if><

Spring MVC 详解

第一章 Web MVC简介Web MVC简介 1.1.Web开发中的请求-响应模型:   在Web世界里,具体步骤如下: 1.  Web浏览器(如IE)发起请求,如访问http://sishuok.com 2.  Web服务器(如Tomcat)接收请求,处理请求(比如用户新增,则将把用户保存一下),最后产生响应(一般为html). 3.web服务器处理完成后,返回内容给web客户端(一般就是我们的浏览器),客户端对接收的内容进行处理(如web浏览器将会对接收到的html内容进行渲染以展示给客户)

spring mvc 的一个问题

问题描述 链接1:<a href="http://www.siteurl.com/class-1-0-0-index-1-1.html" target="_blank">测试1--class<a><br/>链接2:<a href="http://www.siteurl.com/class-1-4-30-index-1-0-0-0-0-0-0-0-0-1.html" target="_blank&

spring mvc+shiro+cas 实现cas client功能 跳转回来404

问题描述 spring mvc+shiro+cas 实现cas client功能 跳转回来404 http://securitycenter.com:8080/gtsys/cas?ticket=ST-14-HEDhc1GVQt0UYdiZpi7R-cas 返回这个地址 404 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.or

Spring MVC报异常:org.springframework.web.util.NestedServletException: Request processing failed

在使用SpringMVC绑定基本类型(如String,Integer等)参数时,应通过@RequestParam注解指定具体的参数名称,否 则,当源代码在非debug模式下编译后,运行时会引发HandlerMethodInvocationException异常,这是因为只有在 debug模式下编译,其参数名称才存储在编译好的代码中. 譬如下面的代码会引发异常: Java代码    "收藏这段代码") @RequestMapping(value = "/security/log

spring mvc datajpa整合时出现找不到类的情况,百度了很多都没有解决问题。

问题描述 spring mvc datajpa整合时出现找不到类的情况,百度了很多都没有解决问题. 用srping mvc和jpa写一个helloworld,没想到还跑不起来 不知道哪里出错了,可能是配置没做好,这里还请大家帮忙看看是什么没问题. 下面是我的代码: 这是个controller package com.ll.together.controller; import com.ll.together.service.LoginBQqService; import org.springfr

Spring MVC 4.2.2 中最好的集成静态资源的方法

Spring MVC 4.2.2 中最好的集成静态资源的方法 太阳火神的美丽人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致"创作公用协议 转载请保留此句:太阳火神的美丽人生 -  本博客专注于 敏捷开发及移动和物联设备研究:iOS.Android.Html5.Arduino.pcDuino,否则,出自本博客的文章拒绝转载或再转载,谢谢合作. Spring MVC 4.2.2 – Best way to Add/Integra

Spring MVC Mybatis多数据源的使用实例解析_java

项目需要从其他网站获取数据,因为是临时加的需求,在开始项目时没想到需要多数据源 于是百度了一下,发现只需要改动一下Spring 的applicationContext.xml文件和编写三个工具类就可以完美实现 applicationContext.xml <!-- 多数据源配置 --> <bean id="ds1" class="org.apache.commons.dbcp.BasicDataSource"> <property na