Code example for CustomNumberEditor

0
     */ 
    @InitBinder 
    protected void initBinder(HttpServletRequest request, 
                              ServletRequestDataBinder binder) { 
        binder.registerCustomEditor(Integer.class, null, 
                                    new CustomNumberEditor(Integer.class, null, true)); 
        binder.registerCustomEditor(Long.class, null, 
                                    new CustomNumberEditor(Long.class, null, true)); 
        binder.registerCustomEditor(byte[].class, 
                                    new ByteArrayMultipartFileEditor()); 
        SimpleDateFormat dateFormat =  
            new SimpleDateFormat(getText("date.format", request.getLocale())); 
        dateFormat.setLenient(false); 
        binder.registerCustomEditor(Date.class, null,  
                                    new CustomDateEditor(dateFormat, true)); 
    } 
 
    /** 
     * Convenience message to send messages to users, includes app URL as footer. 
     * @param user the user to send a message to. 
Contextual code suggestions in your IDE  Get Codota for Java