简体   繁体   English

如何更改页面网址

[英]How to change a page url

I have this simple controller: 我有这个简单的控制器:

  @RequestMapping("changeTestCase")
public ModelAndView modifyTestCase(){
    ModelAndView model = new ModelAndView("changeTestCase");
    model.addObject("testCases",TestCase.getTestCases());
    model.addObject("types", TestType.getTypes());
    return model;
}

This gives me the page url http://localhost:8080/changeTestCase . 这给了我页面URL http://localhost:8080/changeTestCase What I actually want is http://localhost:8080/testCase/change . 我真正想要的是http://localhost:8080/testCase/change How do I do this ? 我该怎么做呢 ? Do I need to create a folder called testCase and put a page called change there or can I just change the name? 我是否需要创建一个名为testCase的文件夹并在其中放置一个名为change的页面,还是可以仅更改名称?

您应该能够只将映射更改为@RequestMapping("testCase/change")并保持其他所有内容不变。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM