search

Home  >  Q&A  >  body text

SpringMVC interceptor modifies URL - Stack Overflow

update 2017-4-25 10:16
Update, this will only happen when redirecting


  1. When using springmvc, inherit HandlerInterceptor and rewrite the postHandle method, add parameters to ModelAndView in the method, if the parameter is an object, it is normal, if it is a basic data type, the jump url will be modified, and the parameters will be used The get method is attached at the back.

  2. The code is as follows

        // 静态的导航栏node
        model.put("nodes", nodeService.getNodeListStatic());
        model.put("navbar", nodeService.getNodeHtmlStatic());
        modelAndView.addAllObjects(model);
  3. This is the url of the interface

    http://localhost:8080/admin/index?navbar=test&isAdmin=true
  4. Has anyone encountered this? How to solve this problem?

phpcn_u1582phpcn_u15822789 days ago692

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-05-17 10:09:06

    You can wrap a class object and put the required parameters into it

    reply
    0
  • Cancelreply