首页 > 解决方案 > 当我尝试在 Spring Mvc 中插入背景图像时,它没有出现

问题描述

我正在尝试使用 Spring MVC 构建一个天气刮板网站。目前,我正在尝试设计网站。当我尝试为此设计插入背景图像时,当我查看 URL (http://localport:8080/weatherScraper) 时,它似乎没有出现。但是,其余元素按预期显示。

我的控制器类:

公共类控制器{

@RequestMapping(value = "/weatherScraper", method = RequestMethod.GET)
public String webpageGet(ModelMap modelMap){
    return "Mainpage";
}

}

我的 MainPage.html

我将图像保存为weather.jpg。我什至尝试了 <body background = "weather.jpg" 和 <body style="background-image:url("weather.jpg")" 并且尝试了很多其他不同的方法,但它仍然对我不起作用。有人可以帮我解决这个问题吗?

标签: javahtmlspring

解决方案


推荐阅读