Testing New Spring MVC Project in STS - Default Ro

2019-04-10 04:39发布

问题:

I'm trying to get into the Spring MVC world and I'm starting by using SpringSource Tool Suite. I've created a new Spring MVC project and I understand the basics. The quick question I have is - what's the best way to change the root context of the default vFabric server that comes with STS?

By default it maps my project to /projectname - but when I finally deploy this project I want it to be in the root context /. Is there a way to change this within STS/vFabric so when I "Run On Server" and it starts up the Tomcat instance, the current project will be in the root context and not the default "VMware vFabric tc Server" page? This just makes it difficult to test out the site since I would be linking to "/mylink" (for example) in the HTML but when running in STS it would be /projectname/mylink

Thanks.

回答1:

  • In the "Servers"-View, right click on the vFabric server
  • select "open"
  • In the opening editor, click on "Modules" (at the bottom of the editor window)
  • You will see your deployed apps, click on the one that should be deployed to ROOT
  • click "edit"
  • change the path to "/", leave the docbase as is
  • save and done