0

I am trying to build a weather Scraper website using Spring MVC. For now, i am trying to make the design of the website. When, i try to insert a background image for this design, it does not seem to appear when i check out the URL(http://localport:8080/weatherScraper). However, the rest of the elements appear as expected.

My Controller class:

public class Controller {

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

}

My MainPage.html

I saved the image as weather.jpg. I even tried <body background = "weather.jpg" and <body style="background-image:url("weather.jpg")" and I tried a lot of other different ways but it still did not work for me. Can someone help me out on this please?

9
  • Refer to the link, it can help you stackoverflow.com/questions/20369529/… Commented Jun 14, 2021 at 21:59
  • The link you sent above suggests that i add <mvc:resources mapping="/resources/**" location="/resources/" /> to the mvc configuartion but what exactly does mvc configuration mean? In which file do i exactly put this? Commented Jun 15, 2021 at 6:03
  • In your spring mvc application, there will be a web.xml, Refer spring documentation Commented Jun 15, 2021 at 10:52
  • i dont have a web.xml Commented Jun 15, 2021 at 18:30
  • Refer stackoverflow.com/questions/14861720/… for java based configuration Commented Jun 15, 2021 at 19:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.