我有这个简单的 Controller :
@RequestMapping("changeTestCase")
public ModelAndView modifyTestCase(){
ModelAndView model = new ModelAndView("changeTestCase");
model.addObject("testCases",TestCase.getTestCases());
model.addObject("types", TestType.getTypes());
return model;
}
这给了我页面 URL http://localhost:8080/changeTestCase
。我真正想要的是 http://localhost:8080/testCase/change
。我该怎么做呢 ?我是否需要创建一个名为 testCase 的文件夹并在其中放置一个名为 Change 的页面,或者我可以只更改名称吗?
最佳答案
您应该能够将映射更改为 @RequestMapping("testCase/change")
并保持其他所有内容不变。
关于java - 如何更改页面 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48806397/