,我想要实现的结果是 http://localhost:8080/index/1 而不是这样的http://localhost:8080/domain/index/1 就是可以不通过类的指向直接访问方法名吗,或者这样也可以直接http://localhost:8080/domain/1 2个只能留一个,,里面方法比较多,求高手解决 下面是我的代码,
 @Controller 
 @RequestMapping("domain")
 public class DomainController extends BaseController {
 
 
 @RequestMapping("/index/{domainId}")
 public String showNewDomain(@PathVariable("domainId") int domainId,
 ModelMap modelMap, HttpServletRequest request) {
 Map<String, Object> maps = new HashMap<String, Object>();
 if (0 == domainId) {
 maps.put("domainId", 0);
 modelMap.addAttribute("domainName", "域");
 } else {
 maps.put("domainId", domainId);
 
 
 modelMap.addAttribute("domainName",
 s.domainService.getDomainVo(maps).getDomainName());
 }
 modelMap.addAttribute("styleList", s.styleService.getStyleTop5BydomainId(domainId,0,5,1,1));
 modelMap.addAttribute("productList", s.productService.getProudctTop5BydomainId(domainId,0,5,1,1));
 modelMap.addAttribute("userId", getUserId(request));
 return "index/domain";
 }
 
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
删掉@RequestMapping("domain") 
 
控制器上的方法不要不就得了
######控制器上的方法不要不就得了
控制器上的方法不要不就得了
或者 把方法上@RequestMapping("/index/{domainId}")的/index去掉
要想都留着,可以把Controller的去掉,方法上写成
@RequestMapping({"/domain/{domainId}","/index/{domainId}"})
######删除controller上的requestmapping######控制器上的方法不要不就得了
控制器上的方法不要不就得了
控制器上的方法不要不就得了
或者 把方法上@RequestMapping("/index/{domainId}")的/index去掉
要想都留着,可以把Controller的去掉,方法上写成
@RequestMapping({"/domain/{domainId}","/index/{domainId}"})
 
 
}