This week's book giveaway is in the Java in General forum. We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line! See this thread for details.
I have uploaded a file to application server's shared folder and the path for the same is some thing like "opt/webapps/myFile.txt".
I want to view/open this file from my JSP page browser, Please help me how to do it??
That should be done in Java code and not a JSP. A Servlet would read the file and stream it to the user. Note that the servlet shouldn't accept the whole path of the file as that would be a security risk.
I am able to access and open the file which is of any type but the code is working only for local files. i.e., If I create a folder in my local machine and put some file there and can able open the same file.
Howerver, I am unable to open the file which stored in Appserver's NAS link.. I am giving the file path as /opt/...../x.txt, still unable to open the file I am getting 404 error.