1

I first setup Spring MVC to handle all urls.

<servlet-mapping>
    <servlet-name>HelloWeb</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

And the dispatcher servlet mapped resources.

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

This worked fine, but now I want to change Spring so that it only handle's '/search/' URLs.

<servlet-mapping>
    <servlet-name>HelloWeb</servlet-name>
    <url-pattern>/search/*</url-pattern>
</servlet-mapping>

This works but my resources no longer work. I think it's because it's looking for the resources in /search/resources rather than /resources. But I'm not sure.

Anyone have any idea why this is happening?

Thanks!

1 Answer 1

1

You can make your static resources visible , configure the static resources in your web.xml.

<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/VAADIN/resource/*</url-pattern>
</servlet-mapping>

If VAADIN is the project name , need not specify it here

Sign up to request clarification or add additional context in comments.

2 Comments

The project name is safesite. Full url of resources is "localhost/safesite/VAADIN/resource/" I added that to my web.xml but now my other URLs for a different Dispatcher Servlet don't work.
The project name is safesite. Full url of resources is "localhost/safesite/VAADIN/resource/" I added that to my web.xml with "default" changed to HelloWeb. Now going to the URL /safesite/resources/images/map.jpg works. Thanks!

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.