Hi i am using spring MVC..i wan to give some alert to user when pass some value from controleer.
this is my part of controller:
@RequestMapping(value="/deleteTeam", method=RequestMethod.POST)
public String editDeleteRecodes(@ModelAttribute NewTeams newTeams, Map<String, Object> map){
Teams teams = new Teams();
teams.setTeamID(newTeams.getTeamID());
try{
teamService.delete(teams);
}catch (DataIntegrityViolationException ex){
map.put("error", "x");
//System.out.println("aaaaa");
}
return "redirect:/";
}
this is front END in jsp
<script type="text/javascript" >
function doAjaxPostTeamDelete (team_ID){
//get the values
//var team_ID = $('#teamID').val();
$.ajax({
type: "POST",
url: "/controller/deleteTeam",
data: "teamID=" + team_ID,
success: function(response){
// we have the response
if(x="${error}"){
alert("You Cant Delete");
}
},
error: function(e){
alert('Error: ' + e);
}
});
}
just i want to how get data from from map to jsp