1.Deploy applications configured in Tomcat instance不要勾上
注意:上传controller的路径要和idea下的真是路径相同
第二种设置虚拟路径的方法
在tomcat\config\server.xml中配置
path="/img" 虚拟路径 docBase图片存放的真实路径
<Context path="image" docBase="D:\imgs" reloadable="true" />
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> <Context path="image" docBase="D:\imgs" reloadable="true" /> </Host>
如果要在idea中启动
.将Deploy applications configured in Tomcat instance勾上