• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem writing to file on a web server  RSS feed

 
nikki swanson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am writing a applet that will read a value from a file make a change to that value and then write it back to that file. now everything works in the applet except for writing back to the file. now for some reason the code i have for writing back to the file via a urlconnection stream will not write back to the file the method for riting back to the file is as follows
public void writefile(String cfile)
{
try
{
URL urlout = new URL(getDocumentBase(),cfile);
URLConnection connection2 = urlout.openConnection();
connection2.setDoOutput(true);
DataOutputStream dataout = new DataOutputStream(connection2.getOutputStream());
countstring=Integer.toString(count2);
dataout.writeUTF(countstring);
dataout.flush();
dataout.close();
}
catch (MalformedURLException e)
{
}
catch (IOException e)
{
}
}
is there something that i am missing, if so what is it and how do a fix the problem. by the way i am not getting an exception errors and it compile fine. i have made a java policy file, that is correct.
do i need some sort of servlet in order to write back to the file. if so where can i get one from or what code is it.
any help would be great, thanks nikki.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!