Pom.xml:
Jetty Plug-in configuration:
<plugin> <groupId>Org.mortbay.jetty</groupId> <Artifactid>Maven-jetty-plugin</Artifactid> <version>6.1.5</version> <Configuration> <Scanintervalseconds>1</Scanintervalseconds> <webappsourcedirectory>Src/main/webapp</webappsourcedirectory> <Scanintervalseconds>3</Scanintervalseconds> <contextPath>/</contextPath> <Connectors> <connectorImplementation= "Org.mortbay.jetty.nio.SelectChannelConnector"> <Port>8088</Port> </connector> </Connectors> </Configuration> </plugin>
Welcomepage:
@Controller @requestmapping ("/") Public classWelcomepage { PublicString Index () {return".. /index "; } @RequestMapping ("Index") PublicString Index2 () {return"Index"; } @RequestMapping ("Login") PublicString Login () {return"Index"; } @RequestMapping ("Calctime") PublicString init () {return"/calctime/calctime"; }}
It used to be a project started with the MAVEN command, and it was a little strange to use it when accessing:
Localhost:8088/index
You can access the page, the other pages are similar, and you do not need to use the project name.
----------------------Split Line------------------------------
Yesterday, a VPS, the project was deployed, using the Tomcat
Tomcat starts normally and is not saved, but it is not connected to the server.
With a try mentality, add a project name
Ip:8080/project_name/index
The access is OK, but the other pages are not open.
The error is 404 and cannot be found.
Check to see that all requests are not with the project name , and of course the URL will not have the project name.
Nature is not accessible.
Plus the project name, the other connection access is normal.
is preparing to change, suddenly found that in the local and can not access.
This is embarrassing, without the project name, the server can not access, add the project name, local and not access .
It suddenly occurred to me that the development was using jetty, deployed with Tomcat.
Previous projects, also useless such a problem.
Never be too foolish.
Look at the configuration of the jetty:
<plugin> <groupId>Org.mortbay.jetty</groupId> <Artifactid>Maven-jetty-plugin</Artifactid> <version>6.1.5</version> <Configuration> <!--Hot Deploy - <Scanintervalseconds>1</Scanintervalseconds> <webappsourcedirectory>Src/main/webapp</webappsourcedirectory> <Scanintervalseconds>3</Scanintervalseconds> <contextPath>/project_name</contextPath> <!--The name of the war package-- <Connectors> <connectorImplementation= "Org.mortbay.jetty.nio.SelectChannelConnector"> <Port>8088</Port> </connector> </Connectors> </Configuration> </plugin>
Change, the ContextPath configuration is good.
In this way, the project's access path is added with the project name, consistent on the local and server, and enjoyable to play.
Spring MVC project, a project name that differs from the Tomcat path using the jetty plugin