오류사항
2023-05-23 13:52:00,916 [http-nio-7070-exec-1] WARN o.s.w.s.m.s.DefaultHandlerExceptionResolver - Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required List parameter 'value' is not present]
javascript
let values = [];
$('input[name=check]:checked').each(function(){
values.push($(this).val());
});
$.ajax({
url: 'filelog/download',
type : 'POST',
traditional: true,
data: {
value: values
},
success : function(response){
console.log(response);
},
error : function(e){
alert('Error : ' + e);
}
});
controller.java
@ResponseBody
@PostMapping("/filelog/getlayer")
public FilelogsDto getLayer(Model model, @RequestParam("value") int id){
try {
FilelogsDto dto = service.getLayer(id);
return dto;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}