hi guys, i am developing a webapp called LearningPlatform, i have written some 
secure actions in struts2 for the login section, placed them in a  package with 
namespace="secure" , and now static contents like images and .css files that 
invoke images get served relative to "secure" like /secure/images/Header.jpg, 
although the "images" folder is placed in app's context root.(LPlatform/images)
The error i get from Tomcat is HTTP Status 404: 
"The requested resource (/LPlatform/secure/images/Header.jpg) is not 
available."
I tried rewriting the urls inside the jsp's as absolute paths, like  
/images/Header.jpg , but then i get:
"HTTP Status 404 The requested resource (/images/Header.jpg) is not available."

The images are served ok when using actions in  the root ("/") namespace.

One fix i found is to set the Context's path in server.xml to blank so that 
both absolute and relative image paths get served directly from localhost:8080, 
but that's not a feasible solution (in case i have more than one app).

The other fix was to use <s:url value="/images/Header.jpg>"  like tags, in 
order to generate the absolute path to the image(the rendered result includes 
/LPlatform/), but this one seems tedious.

I wanted to know if there isn't some way to get absolute paths like 
"/images/Header.jpg" in jsps served relative to the context root of the app (in 
my case LPlatform) ?

I've been struggling for a few days with this now, so i appreciate any help. 
Thx a lot.







      

Reply via email to