wilflife
asked on
Load xml file
Hi,
I have a jsp file called behind the scenes by a client html file.
The jsp page has to load an xml file which is in the same directory as the jsp page.
The only way i can get it to load is when i put the full windows path.
I use
File thefile = new File("Thexml.xml"); //does not work
File thefile = new File(http://correctpathtofilewhichworksinbrowser); //does not work.
File thefile = new File("../directoryabove/xm lfile.xml" ); //does not work.
The only way that works is
File thefile = new File( "c:\\pathtofile");
Thanks.
I have a jsp file called behind the scenes by a client html file.
The jsp page has to load an xml file which is in the same directory as the jsp page.
The only way i can get it to load is when i put the full windows path.
I use
File thefile = new File("Thexml.xml"); //does not work
File thefile = new File(http://correctpathtofilewhichworksinbrowser); //does not work.
File thefile = new File("../directoryabove/xm
The only way that works is
File thefile = new File( "c:\\pathtofile");
Thanks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> I couldn't get the <snip> to work even when importing javax.* at the start of my jsp.
You shouldn't have needed to import anything...
especially not javax.* which doesn't import any classes (there is nothing inside javax.*)
Tim
You shouldn't have needed to import anything...
especially not javax.* which doesn't import any classes (there is nothing inside javax.*)
Tim
The only problem with that method is that it isnt portable. In most cases this wont be a problem, but good to know.
colr__
colr__
ASKER
I couldn't get the
new File( getServletContext().getRea
to work even when importing javax.* at the start of my jsp.
Thanks.