This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes hyperlinking files in a servlet 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 » Java » Servlets
Bookmark "hyperlinking files in a servlet" Watch "hyperlinking files in a servlet" New topic
Author

hyperlinking files in a servlet

ramu av
Greenhorn

Joined: Feb 25, 2003
Posts: 28
hello

i'm not able to hyperlink the files with extensions other than .txt or .doc
or .html

if extension is .xls or .zip the file is displaying the files in binary format

the code is
out.println("<a href='/titans/something.xls>something</a>");

it works fine if i give the absolute path.

do i need to chand the content type??

somebody help me please.
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Have you tried setting MIME mappings in web.xml file ?
Example
Extension: pdf
MIME Type: application/pdf

is it only occuring in servlet or in static html files as well ?


Spritle Software Blogs
ramu av
Greenhorn

Joined: Feb 25, 2003
Posts: 28
thanks balaji,

but the problem comes only in the servlets and not in the static pages.
ramu av
Greenhorn

Joined: Feb 25, 2003
Posts: 28
thanks a lot balaji,

i tried what you had mentioned and my problem is solved.

thanks again.
 
Consider Paul's rocket mass heater.
 
subject: hyperlinking files in a servlet
 
Similar Threads
Send and Receive Binary Data in XML
XStream --> getting "id=someId"
SVG slidetool
Logging ..adivse
not logging as coded