Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8465233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:58:59+00:00 2026-06-10T14:58:59+00:00

I have a standalone simple java web application with servlets and jsp, say the

  • 0

I have a standalone simple java web application with servlets and jsp, say the name is FileDisplay I am access its home page through url – http://localhost:8080/FileDisplay/index.jsp.

What the application essentially does is, retrieves a list of file names(.xml’s and .pdf’s) with complete path. These files are stored in various external directories, say D:\ABCD, D:\XYZ, D:\PP\2012\08 etc but on the same machine as the web application just on a different drive. So the return list is something like-

D:\ABCD\filename1.xml  
D:\ABCD\filename2.xml  
D:\ABCD\pdf1.pdf 

If I use a simple <a href=""> in the jsp then it doesnt work. in the viewsource it looks like –

<a href="D:\ABCD\pdf1.pdf">file1</a>

I think it is beacause these files are not part of the webapp, so the container doesnt think it is local and hence unable to open them. When I place the mouse pointer over the link, the status bar shows as file:///D:\ABCD\pdf1.pdf. I also tried prefixing file:/// in the href, even then it doesnt work. So I tried a few other things.
One thing I tried is setting the Context in Tomcat’s server.xml but even that doesn’t seem to work. I am using eclipse to build and deploy and run the tomcat, so the server.xml I modified for this context is one within the eclipse workspace.
The setting I used is –

<Context docBase="D:/ABCD" path="/File-Display/NB" reloadable="true"/>  

I have another context set for the main application which is –

<Context docBase="FileDisplay" path="/FileDisplay" reloadable="true" source="org.eclipse.jst.j2ee.server:FileDisplay"/>  

What am I doing wrong here?

Does it explain a bit more now?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:59:01+00:00Added an answer on June 10, 2026 at 2:59 pm

    I think you are on the wrong way.

    If you want to provide access to different files distributed in your file system create controller (servlet) that accepts URL, reads appropriate file and writes it to the response output stream.

    This way you can control access to your resources, make them secure, etc. You will be able to modify your application easily (e.g. if you change the files location). Etc, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say that you have a standalone application (a Java application in my case)
I have a standalone java application that fires up several JMS consumers using the
I have a standalone application, and one of its duties is to take the
I need to write a standalone Java application which will have a embedded HTTP
I have a standalone Java application that uses EclipseLink 2.0.1. It is configured by
I have a simple standalone application written in Visual Basic that I'm porting to
I have started a simple servlet 3.0 project which contains now a jsp page
I have a standalone application in which I have to prompt the user with
Hai I have developed a standalone application in which when an user logs in,
I am developing a standalone application, in Java using NetBeans, that gets and sends

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.