java - New view doesn't load in Spring MVC after request from jQuery -
i have little confuse problem spring mvc. view doesn't load after request jquery. controller called, view on web browser doesn't change.
explain step step do:
click button jquery script:
$(function() { $('.btn-danger').click(function() { $.ajax({ url: '/admin/delete', type: 'get', }); //location.href = '/admin/delete/'; }); });
my controller activated (i see log:'admin delete get'):
@requestmapping(value = "/admin/delete/**", method = requestmethod.get) public string deleteget(model model) { log.debug("admin delete get"); return "home"; }
view "home" doesn't load :( why?
if remove lines in jquery script ajax , remain location.href, view "home" loaded.
$(function() { $('.btn-danger').click(function() { location.href = '/admin/delete/'; }); });
view: boostrap
spring boot : 1.2.2
java: 1.8
sitemesh: 3.0
modify deleteget
return modelandview
, inside of function create model , view object , return it:
modelandview model = new modelandview(); model.setviewname("home"); return model;
also can problem mappings. log show error? suggest provide <bean id="viewresolver">
configuration. must defined in *-servlet.xml
Comments
Post a Comment