我在spring mvc 4中有两个控制器类.. / admin / brand it's work,但/ admin not working .. 如何映射请求/管理员?我现在,我可以在一个控制器中映射所有方法,但我想要它不同的控制器。 抱歉英语不好......
@Controller
@RequestMapping(value = "/admin/brand")
public class AdminController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String admin() {
return "adminbrand";
}
}
@Controller
@RequestMapping(value = "/admin")
public class AdminBrandController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String admin() {
return "adminBrand";
}
}
答案 0 :(得分:0)
试试这个:
@Controller
public class AdminBrandController {
@RequestMapping(value = "/admin/brand", method = RequestMethod.GET)
public String adminBrand() {
return "adminBrand";
}
}
@Controller
public class AdminController {
@RequestMapping(value = "/admin", method = RequestMethod.GET)
public String admin() {
return "admin";
}
}