用于开发的Tomcat配置,如何添加webapp以及引用静态文件 [英] Tomcat configuration for development, how to add a webapp, as well as reference static files
问题描述
我想拥有一个网络应用,然后将其配置为从直接路径加载静态文件。
这是webapp配置:
< Context docBase =E:\ webapp1path =/oadable =true/>
如何设置静态资源。
我假设您的Tomcat已经可以运行在 http:// localhost:8080 /
您需要做的就是将静态资源放在
<$ p的子文件夹中$ p>
E:\ webapp1
like
E:\ webapp1 \\\\1.jpg
E:\ webapp1 \css \ style.css
E:\ webapp1 \html \ abc.html
将上下文中的路径更改为所以这个webapp可以作为默认的webapp 运行,即webapp名称不会成为URL
的一部分,您可以直接将其作为
http:// localhost:8080 / jpg / 1.jpg
http:// localhost:8080 / css / style.css
http:// localhost: 8080 / html / abc.html
这是你在寻找什么?这是我对你的问题的理解
I want to have a web app and then configure it to load static files from a direct path.
This is the webapp configuration:
<Context docBase="E:\webapp1" path="/" reloadable="true"/>
How do I setup the static resources.
I assume your Tomcat already can run at http://localhost:8080/
All you need to do then is to put your static resources in sub-folders of
E:\webapp1
like
E:\webapp1\jpg\1.jpg
E:\webapp1\css\style.css
E:\webapp1\html\abc.html
Change the path in Context to ""
so this webapp can run as the default webapp i.e. the webapp name will not be part of the URL
and you can directly serve these as
http://localhost:8080/jpg/1.jpg
http://localhost:8080/css/style.css
http://localhost:8080/html/abc.html
Is this what you were looking for? This is my understanding of your question
这篇关于用于开发的Tomcat配置,如何添加webapp以及引用静态文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!