Before ask this question, I have already read the forum and tried a lot of from forum suggestions. I do not know , maybe i do not clearly understand or maybe the reason that i apply to my current project, however answer on the forum is not working in my project
Java:
@RequestMapping(value = "/warehouseWhisky", method = {RequestMethod.GET, RequestMethod.POST}) public ModelAndView viewAllWhiskyInWarehouse() { Iterable<WhiskyDTO> list = whiskyService.seeAllWhisky(); String email = receiveEmailFromSecurity.getEmail(); System.out.println(email); ModelAndView modelAndView = new ModelAndView(); modelAndView.addObject("viewAvailableWhisky", list); modelAndView.addObject("email", email); modelAndView.setViewName("whisky"); return modelAndView; }This code correct, I recive in HTML string:
<input type="button" id="someThingNew" th:value="${email}"/>
But I didn't recieve this parameters in js:var nameUser = $("#someThingNew").val(); console.log(nameUser);