let array = [1,2,3,4,5,6,7,8,9,10,11]
const chunkSize = 3;
let chunks = [];
for (let i = 0; i < array.length; i += chunkSize) {
chunks.push( array.slice(i, i + chunkSize) );
}
// на выходе
[
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[10, 11]
]
@Controller
public class Controller404 {
@RequestMapping("/404")
public String error404() {
return "/404";
}
}
Чтоб отловить ошибки.
@ControllerAdvice
public class MyExceptionHandler {
@ResponseStatus(HttpStatus.FORBIDDEN)
@ExceptionHandler(Exception.class)
public String handler(Exception ex){
return "/404";
}