I am using java Spring MVC,i want show this msg for user.. This my part of controller
@RequestMapping(value="/DeleteTeam", method=RequestMethod.POST)
public String editDeleteRecodes(@ModelAttribute NewTeams newTeams, BindingResult result, @RequestParam String action, Map<String, Object> map){
Teams teams = new Teams();
teams.setTeamID(newTeams.getTeamID());
try{
teamService.delete(teams);
}catch (DataIntegrityViolationException ex){
map.put("error", "Frist Delete Releases");
}
return "redirect:/";
}
set one attribute if you want to alert and manage it accordingly. then check in your jsp for that attribute whether it is null or having some value if so simple alert <script>alert("Your alert")</script>
EDIT:
on server side set attribute like
request.setAtrribute("error", "error");
on your jsp page check for attribute like
if(request.getAttribute("error")!=null){
<script>alert("hi")</script>
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.