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:

  1. click button jquery script:

    $(function() {   $('.btn-danger').click(function() {     $.ajax({         url: '/admin/delete',         type: 'get',     });      //location.href = '/admin/delete/';   }); }); 
  2. 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"; } 
  3. 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

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -