【问题标题】:CSS not loading when used with PathVariable in Spring在 Spring 中与 PathVariable 一起使用时 CSS 未加载
【发布时间】:2018-05-06 11:04:45
【问题描述】:

我在与 Spring 一起使用时遇到 CSS 加载问题。请查找以下代码。

@RequestMapping(value = "/view/{id}" , method = RequestMethod.GET)
    public ModelAndView viewStudentById(@PathVariable("id") int id) {
        ModelAndView model = new ModelAndView("viewStudent");
        model.addObject("studentdata",this.studentService.findStudentById(id));
        return model;
    }

但是“viewStudent”jsp页面的value =“/view”CSS已加载。谁能帮我解决这个问题?为什么我无法使用 (value = "/view/{id}" 加载 CSS?

【问题讨论】:

    标签: java html css spring


    【解决方案1】:

    我通过下面的代码解决了这个问题。

    我在 href 中缺少 /。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-07
      • 2012-01-07
      • 1970-01-01
      • 2019-06-23
      • 2018-07-07
      相关资源
      最近更新 更多