spring - Request processing failed; nested exception is java.lang.NumberFormatException: null -
spring - Request processing failed; nested exception is java.lang.NumberFormatException: null -
i'm getting error request processing failed; nested exception java.lang.numberformatexception: null
.
here code:
@controller @requestmapping("/customeradmin") public class customeradmincontroller { @initbinder public void initbinder(webdatabinder binder) { binder.registercustomeditor(customer.class, "customer", new propertyeditorsupport() {@ override public void setastext(string customer) { setvalue(new customer(integer.parseint(customer))); } }); } @requestmapping(value = "/addprofile.htm", method = requestmethod.get) public modelandview addprofileform(modelmap model, httpservletrequest request) { int id = integer.parseint(request.getparameter("id")); system.out.println(id); profile profile = new profile(); client customer = new customer(id); profile.setcustomer(customer); model.addattribute("profile", profile); modelandview mav = new modelandview("addprofile"); homecoming mav; } }
am getting error as
oct 16, 2014 4:31:47 pm invoke
severe: servlet.service() servlet [dispatcherservlet] in context path [/customerportal] threw exception [request processing failed; nested exception java.lang.numberformatexception: null] root cause
try adding this:
int id = integer.parseint(request.getparameter("id"));
java spring hibernate spring-mvc
Comments
Post a Comment