File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Problem with the Contextpath in the url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with the Contextpath in the url" Watch "Problem with the Contextpath in the url" New topic

Problem with the Contextpath in the url

sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415

I am facing a problem which i am not able to get the complete solution .In my web application i have a folder(this folder name is not fixed ) and inside that i have a HTML page which has images . i am opening that file using an action ( i am not directly opening this as i cant handle filenotfound exceptions and all ) ......and the problem here is i am not getting the images as the browser is looking in for images directly under my context .

my action for opening the doument looks like this
http://localhost:8080/myapp/ variblefoldername/filename

and in my action class i am just opening that using new ActionForward(path) in the url as this is a forward and i tries making it a redirect so that url gets updated as http://localhost:8080/myapp/variablefoldername/filename and this works fine but there is a problem with the Excel file as content type in header gets lost on using a redirect .Hence junk comes for Excel file .................

so can any give me a solution for this
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
Have you tried configuring the MIME type for *.xls in your web.xml?

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415

thanks its working now with that entry in applications web.xml.............earlier i tried by adding this in tomcat\conf\web.xml and this was not working
It is sorta covered in the JavaRanch Style Guide.
subject: Problem with the Contextpath in the url
Similar Threads
File Upload Question
Tomcat 404 error
Deploy overwrites folder.
integration of struts- jsf Problem related t url
context root change