vamshipajjuri
asked on
how to specify relative path in jsp
hi all,
i want the client to download a file from server side
here is my directiory structure
WebRegistration
/ \
/ \
/ \
jsp WEB-INF
/ \
/ \
/ \
localreg classes
/
/
registration
/
/
files
my jsp's are in left "localreg" folder and my java programs are in "registration" folder and the file which client should download is in "files" folder
here is the jsp which i am using to make client download the file
String filename ="download.ash";(this is in "files"folder)
String filepath =
response.setContentType("A PPLICATION /OCTET-STR EAM");
response.setHeader("Conten t-Disposit ion","atta chment; filename=\"" + filename + "\"");
out.flush();
java.io.FileInputStream fileInputStream =new java.io.FileInputStream(fi lepath+"/" +filename) ;
int i=0;
while ((i=fileInputStream.read() )!= -1)
{
out.write(i);
}
fileInputStream.close();
out.flush();
out.close();
what i want to know is how should i write "filepath"(in the porgram) relatively.
thanks in advance
regards,
vamshi
i want the client to download a file from server side
here is my directiory structure
WebRegistration
/ \
/ \
/ \
jsp WEB-INF
/ \
/ \
/ \
localreg classes
/
/
registration
/
/
files
my jsp's are in left "localreg" folder and my java programs are in "registration" folder and the file which client should download is in "files" folder
here is the jsp which i am using to make client download the file
String filename ="download.ash";(this is in "files"folder)
String filepath =
response.setContentType("A
response.setHeader("Conten
out.flush();
java.io.FileInputStream fileInputStream =new java.io.FileInputStream(fi
int i=0;
while ((i=fileInputStream.read()
{
out.write(i);
}
fileInputStream.close();
out.flush();
out.close();
what i want to know is how should i write "filepath"(in the porgram) relatively.
thanks in advance
regards,
vamshi
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It is time to clean this abandoned question up.
I am putting it on a clean up list for CS.
<recommendation>
points to knihgtEknight
</recommendation>
If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.
Cd&
I am putting it on a clean up list for CS.
<recommendation>
points to knihgtEknight
</recommendation>
If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.
Cd&
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>
If the user does not know how to close the question, the options are here:
https://www.experts-exchange.com/help/closing.jsp
Cd&