I am quite new in the Spring MVC world and I have a doubt about the corretct creation of a Spring MVC project.
When I run an imported project (for example the Spring MVC Showcase example downlodable form the STS dashboard), inside the browser URL bar this project have an URL like: http://localhost:8080/project-name/
For example the Web MVC Showcase example have project name: "spring-mvc-showcase" and have the following URL: for example the Web MVC Showcase example have project name: "spring-mvc-showcase" and have the following URL: http://localhost:8080/spring-mvc-showcase/
Now, my doubt is related to the creation of a new Spring MVC project using Spring Template in STS\Eclipse.
I do the following operation inside STS:
File --> New --> Project and appears to me a wizard where I can chose the type of project.
So I chose Spring Template Project, now appears to me ano other wizard windows where I can chose the specific typology of Spring Project and I chose "Spring MVC Project"
Ok, now appears to me an other wizard windows in which I have to set up:
Project name and I insert: my-spring-project
Top level package and I have insert: org.mycompany.foo
Ok, now I run my project on server, this don't run and inside the URL bar of the browser I have not http://localhost:8080/my-spring-project/ (as I would expect) but I have: http://localhost:8080/foo/
In the stacktrace I have the following error message:
Then if I do a project clean of my project, STS rebuild the project and if I try to run it again the project run well and the URL address still remain: http://localhost:8080/foo/
WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/foo/] in DispatcherServlet with name 'appServlet'
I think that this is a strange behavior and I have not ideas what is the reason about it...
1) Why the URL is not http://localhost:8080/my-spring-project/ but is http://localhost:8080/foo/ ?
2) Why I have to clean and rebuild my project to run it?
3) I am doing some error in the creation of a standard Spring MVC project?
I am going crazy...
Thank you very much