jaysensharma / MiddlewareMagicDemos

Middleware Technology Related Demos
http://middlewaremagic.com/
31 stars 54 forks source link

Simply does not work... #2

Closed gmarshall56 closed 8 years ago

gmarshall56 commented 8 years ago

I have implemented the sample provided here on a Weblogic 12c server. I have this directory established: C:\nrdImagesDir\slideshow, and \slideshow is populated with, among others, a file named USDA.jpg and a file named V4W_5.jpg. Here is my weblogic.xml:

<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.6/weblogic-web-app.xsd">

<virtual-directory-mapping>
    <local-path>C:/nrdImagesDir</local-path>
    <url-pattern>/slideshow/*</url-pattern>
    <url-pattern>*.jpg</url-pattern>
</virtual-directory-mapping>

On my index.jsp page I have two img tags: img src="http://localhost:7001/NRDAlphaSpringAngular/slideshow/USDA.jpg" and: img src="V4W_v5.JPG"

When the page renders I get: http://localhost:7001/NRDAlphaSpringAngular/slideshow/USDA.jpg 404 (Not Found) http://localhost/NRDAlphaSpringAngular/V4W_v5.JPG 404 (Not Found)

I've been wrestling with this for the last three hours with no success. I have tried using forward slashes and back slashes in the local-patha nd url-pattern nodes. It appears that WLS is simply ignoring the virtual-directory-mapping tag in the weblogic.xml file. Any ideas? Thank you. Gary

gmarshall56 commented 8 years ago

I figured it out. The demonstration shown is a bit misleading in that it states all you need to specify in your jsp page is: img src="aaa/Struts_20_A.JPG".

Well, no. I had to specify much more than that. The following worked for me: img src="http://localhost/NRDAlphaSpringAngular/slideshow/USDA.jpg"

So an FYI for anybody in the future.