Spring mvc 在spring mvc应用程序中使用path变量时未显示图像

Spring mvc 在spring mvc应用程序中使用path变量时未显示图像,spring-mvc,Spring Mvc,我试图在我的Spring mvc应用程序中显示背景图像。现在,该图像显示在我的主页中,但当我单击指向同一页面的链接并将某些参数附加到url时,该图像不会显示 我正在使用此标签显示图像: <img src="./resources/css/welcome.png" id="bg" alt=""> 我无法理解当welcome.html url中没有路径变量时图像是否出现,为什么在单击url中附加路径变量的MyLink时图像没有加载?请在这里帮助我。使用jstl标记核心库和

我试图在我的Spring mvc应用程序中显示背景图像。现在,该图像显示在我的主页中,但当我单击指向同一页面的链接并将某些参数附加到url时,该图像不会显示

我正在使用此标签显示图像:

       <img src="./resources/css/welcome.png" id="bg" alt="">

我无法理解当welcome.html url中没有路径变量时图像是否出现,为什么在单击url中附加路径变量的MyLink时图像没有加载?请在这里帮助我。

使用jstl标记核心库和c:URL创建图像src定义

       <mvc:resources mapping="/resources/**" location="/resources/" />
       <a href="http://localhost:8080/chatbooster/welcome/mycategory">MyLink</a>
   @Controller
    public class WelcomeController  {

@RequestMapping(value = "/welcome/{category}", method = RequestMethod.GET)
public String showPage(Model modelMap, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    try {

        return "welcome";
    } catch (Exception exception) {

    }
}

@RequestMapping(value = "/welcome", method = RequestMethod.GET)
public String showPage1(Model modelMap, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    try {

        return "welcome";
    } catch (Exception exception) {

    }
}

 }