2
votes

I am getting this error :

o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI

when I try to render a view from an controller/action

I've read about it being that servlet mapping being:

Spring MVC Dispatcher Servlet /webspring/*

and the star hijacks even the jsp renderings. How can I overcome this ( as simple as possible ) and hopefully without having to resort to .do endings so it becomes controller/action.do

Thanks !

===============EDIT=================

It appears that this happens if your jsp is not in the WEB-INF folder, but outside but in WebContent... any idea why? The jsp's cant be outside? Or shouldnt?

But now I still have problems with linking to a css file... which usually are outside of the web-inf directory, right?

A link:

    <link rel="stylesheet" href="webspring/public/main.css" type="text/css"/>

where the directory structure is:

  • WebContent
  • WEB-INF
  • webspring

    • public

      main.css

... is being resolved to

http://localhost:8080/XXXWeb/webspring/auth/webspring/public/main.css

when the style tag is added on page with url:

http://localhost:8080/XXXWeb/webspring/auth/loginForm

auth is the controller.

What is going on here?

1
It appears that this happens if your jsp is not in the WEB-INF folder, but outside but in WebContent... any idea why? The jsp's cant be outside? Or shouldnt? Thanks! - mjs
can you show me your deployment descriptor file for more information. - Chitresh

1 Answers

0
votes

I got the same problem with you. So I resolve like this

<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/webspring/auth/webspring/public/*</url-pattern>
</servlet-mapping>