Static content of jsp does not appear

2

I'm using netbeans 7.3.1, apparently it's working ok. The pages are opening normally, but when I try to access the css, jpg, ... content inside the resources folder, no content appears.

In the dispatcher-servlet.xml file I put the following line:

<mvc:resources mapping="/resources/**" location="/resources/" />

and in index.jsp, I placed the call as follows: <link rel="stylesheet" href="resources/css/style.css" type="text/css"/>

Could anyone help me?

    
asked by anonymous 21.02.2014 / 22:30

2 answers

1

Problem has been fixed.

The question was where the resources folder was, for some reason, as "utluiz" had mentioned, it was not in the correct place, because it was another folder. So I created a "resources" folder in the "web app" folder as follows

Youdidnothavetoperformanymappinginthe"dispatcher-servlet.xml". Therefore, the lines that had been placed were removed

Thank you!

    
23.02.2014 / 02:48
0

You first put the images and styles into a resources directory. Although it's the same name you're using, this is not the same thing.

Note that the title of the upper element is "Other Source Codes". These resources are actually those used in the Java application as configuration files.

The correct location for styles and images is within "Web Pages".

Assuming you move the two folders into "Web Pages", I suggest changing your annotation as follows:

<mvc:resources mapping="/img/**" location="/img" />
<mvc:resources mapping="/css/**" location="/css/" />

Note that the location attribute refers to the root of the application, which is "Web Pages". In fact, if Netbeans is following the Maven framework, this folder is src/main/webapp , but it ends up hiding the real location. This is where you should receive the features of the webapp.

    
21.02.2014 / 22:53