Code example for CustomNumberEditor

0
    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. 
     * @param msg the message to send. 
     * @param url the URL of the application. 
Experience pair programming with AI  Get Codota for Java