File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes static content (css and EXT-JS JavaScript) not found 404 (SOLVED) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "static content (css and EXT-JS JavaScript) not found 404 (SOLVED)" Watch "static content (css and EXT-JS JavaScript) not found 404 (SOLVED)" New topic
Author

static content (css and EXT-JS JavaScript) not found 404 (SOLVED)

James Gadbury
Greenhorn

Joined: Mar 20, 2009
Posts: 24
Hi all,

Sorry if this is in the wrong forum - I'm not sure what this should fall under. I have a Maven-based WTP web app using struts 2 / Sitemesh / EXT-JS.

When I run the project using a Tomcat 6 embedded server in Eclipse (3.4) and inspect using Firebug, I am being told that various decorator-related css files and EXT-JS JavaScript could not be found (404). I can also see that files are not loaded as my Sitemesh decorator is not applied and the EXT-JS Javascript is not executed (see below). In fact, my Struts 2 internationalisation is not being applied from my package_<country_code>.properties files, so I suspect something is very wrong with the project structure:



I have triple-checked the URLs - they appear fine to me. The web app is deployed in it's entirety on to the Eclipse-based local Tomcat server and I can see all the files including the 'missing' ones within the <ContextPath>/static/css and <ContextPath>/static/ext directories. I have also tried deleting and adding a new Tomcat server in Eclipse.

Here is my project structure.



This is what my project looked like prior to the EXT-JS - in fact, I had some EXT-JS functioning so something has broken since:



Tomcat server context.xml:


Tomcat server server.xml:


extTest.jsp:


Does anyone have any ideas or pointers at all? I noticed I had a context element with a docRoot parameter in one of the deployment descriptors once but now it has gone...

James Gadbury
Greenhorn

Joined: Mar 20, 2009
Posts: 24
My colleagues and I have found the solution so here it is in case someone else comes across this...

We realised that changing the versions of our Struts2 libraries...

struts2-core-2.0.12.jar to struts2-core-2.1.6.jar
xwork-2.0.6.jar to xwork-2.1.2.jar

...was causing the problem with the static content not loading.

By changing the struts2 filter mapping in the web app deployment descriptor (web.xml) from...


to...



...one can use the struts2-core.2.1.6.jar and xwork.2.1.2.jar

If a moderator reads this, could this post please be moved to the struts2 forum - when I posted, I had no idea what the problem was related to!
 
wood burning stoves
 
subject: static content (css and EXT-JS JavaScript) not found 404 (SOLVED)
 
Similar Threads
Tomcat rediretion - Domain
Struts Application (WAR) file deploy
problem in starting tomcat with eclipse
Redirecting to HTTPS
SSL on Tomcat -- No, not your typical question!