【问题标题】:Spring Boot .html files not resolvingSpring Boot .html 文件无法解析
【发布时间】:2017-12-01 04:41:52
【问题描述】:

我有一个 Spring Boot 应用程序 -

我有一个控制器 -

@Controller("CWOController")
@RequestMapping(value = "/cworequest")
public class CWOController {


    @RequestMapping(value = {"/index.html"}, method = {RequestMethod.GET})
    public String getCwoIdSearchForm(Model model) {
        model.addAttribute("cwoRequestForm", new CWORequest());
        return "index";
    }

这适用于网址 -> http://localhost:8080/cworequest/

但我需要 -> http://localhost:8080/cworequest/index.html 映射到上面的 GET。

我该怎么做?

【问题讨论】:

  • 你能看看下面的链接吗
  • 感谢 Praddep...抱歉,我的映射有误。这是它的样子。 @RequestMapping(value = {"/"}, method = {RequestMethod.GET}) public String getCwoIdSearchForm(Model model) { model.addAttribute("cwoRequestForm", new CWORequest());返回“索引”; }
  • 现在你能解决了吗?

标签: html spring spring-boot


【解决方案1】:

使用映射 / 添加另一个默认方法并返回错误或其他任何内容。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-10
    • 1970-01-01
    • 2017-08-11
    • 2019-06-11
    • 2019-08-31
    • 2014-08-27
    • 2017-07-08
    • 2017-09-20
    相关资源
    最近更新 更多