Re: Accesing file list thro' applet from a web server
Posted By:
Laxman_Subramanian
Posted On:
Friday, February 21, 2003 10:18 AM
Either jar the file along with the applet classes like
InputStream is = getClass().getResourceAsStream("lp.xml");
BufferedReader br = new BufferedReader(new InputStreamReader(is));
java.io.BufferedInputStream bis = new java.io.BufferedInputStream(is);
or open a url connection and read the file as
URL getconnect = null;
URLConnection fetchfile = null;
try {
getconnect = new URL(this.getCodeBase().toString()+lp.xml);
fetchfile = getconnect.openConnection();
BufferedReader in = new BufferedReader(new
InputStreamReader(fetchfile.getInputStream()));
}
These are the two ways by which you can read the file from an applet residing on the same webserver . Applets when run they run on the clients box , so its can access a file on the webserver as a normal file for more info see sanbox restrictions.