Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Requirement : Accessing the static Resources (images/videos., etc.,) from outside of WEBROOT directory or from local disk</strong></p> <p>Step 1 :<br> Create a folder under webapps of tomcat server., let us say the folder name is myproj</p> <p>Step 2 : <br>Under myproj create a WEB-INF folder under this create a simple web.xml</p> <p>code under web.xml</p> <pre><code>&lt;web-app&gt; &lt;/web-app&gt; </code></pre> <p>Directory Structure for the above two steps</p> <pre><code>c:\programfile\apachesoftwarefoundation\tomcat\...\webapps | |---myproj | | | |---WEB-INF | | |---web.xml </code></pre> <p>Step 3:<br> Now create a xml file with name myproj.xml under the following location</p> <pre><code>c:\programfile\apachesoftwarefoundation\tomcat\conf\catalina\localhost </code></pre> <p>CODE in myproj.xml:</p> <pre><code>&lt;Context path="/myproj/images" docBase="e:/myproj/" crossContext="false" debug="0" reloadable="true" privileged="true" /&gt; </code></pre> <hr> <p>Step 4:<br> 4 A) Now create a folder with name myproj in E drive of your hard disk and create a new </p> <p>folder with name images and place some images in images folder <code>(e:myproj\images\)</code></p> <p>Let us suppose myfoto.jpg is placed under <code>e:\myproj\images\myfoto.jpg</code></p> <p>4 B) Now create a folder with name WEB-INF in <code>e:\myproj\WEB-INF</code> and create a web.xml in WEB-INF folder</p> <p>Code in web.xml</p> <pre><code>&lt;web-app&gt; &lt;/web-app&gt; </code></pre> <p>Step 5: <br>Now create a .html document with name index.html and place under e:\myproj</p> <p>CODE under index.html Welcome to Myproj </p> <p>The Directory Structure for the above Step 4 and Step 5 is as follows </p> <pre><code>E:\myproj |--index.html | |--images | |----myfoto.jpg | |--WEB-INF | |--web.xml </code></pre> <p>Step 6: <br>Now start the apache tomcat server</p> <p>Step 7: <br>open the browser and type the url as follows</p> <pre><code>http://localhost:8080/myproj </code></pre> <p>then u display the content which is provided in index.html</p> <p>Step 8: <br>To Access the Images under your local hard disk (outside of webroot)</p> <pre><code>http://localhost:8080/myproj/images/myfoto.jpg </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload