Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
638 views
in Technique[技术] by (71.8m points)

eclipse - URL issue with tomcat include project name

I am using Eclipse for J2EE project... one device send request to my side and url like

http://myIP:myPort/corporationweb/Controller

/corporationweb/Controller is fixed we can't change it because it made on device

my project name in eclipse is "VirtualTest" but here tomcat include project name if i mapping any servlet, /corporationweb/Controller URL like

http://localhost:8080/VirtualTest/corporationweb/Controller

I need page open without change project name

  • any i can mapping servlet directly so URL like http://localhost:8080/corporationweb/Controller
  • any URL rewriting technique..
  • make as default application for my project
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Rightclick project in Eclipse, choose Properties, go to Web Project Settings and set Context root to /.

enter image description here

This will let Eclipse deploy the project on context root instead of project name (which is the default).


Unrelated to the concrete problem, you really need to ensure that your application is written the way so that it does not care on which context path the application is been deployed. This is namely a server specific setting which is not controllable from inside your project. Make use of HttpServletRequest#getContextPath() the smart way.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...