下图中,由于红色部分(value="/")的存在,导致 host:port/项目/dimlist 无法被映射到dimList方法,解决办法是将其去掉。
package cn.bgodata.x.zero.web.ctrl; import org.springframework.stereotype.Component;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*; @Component
@RequestMapping("/dimlist")
public class ZeroBiController { @RequestMapping(value="/", method=RequestMethod.GET)
public String dimList(Model model) { return "dimlist";
} @RequestMapping(value="/{randomcode}/nani", method=RequestMethod.POST)
public String dimList(Model model, String randomcode) {
System.out.println("randomcode = " + randomcode);
return "nani";
}
}