Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applets & Security

 
Neaman Shafiq
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i am trying to create an applet which accepts user input from the user and then creates a new html file at the server side and then writes the user's input to that file. this seems to work fine as an ordinary application. but im experiencing difficulties with the applet version.
iv heard that this is due to the fact that the user cannot create and write to a file on the system the applet is running on for security reasons. can anyone suggest how i can get round this or am i buggered?
the following applet code is causing the trouble:
text=inputField.getText()//just grabbing the text user enterd
try
{
writer=new FileWriter("test.html");
StringTokenizer tokens;
tokens=new StringTokenizer(text);
while(tokens.hasMoreTokens())
{
System.out.println(tokens);
writer.write(tokens.nextToken()+"\n");
}
writer.close();
//load the URL we want to display
url=new URL("file:/c:/work/project/parser/applet/test.html");
//create a HTML viewer to display the url
htmlOutputPane=new JEditorPane(url);
htmlOutputPane.setEditable(false);
scrollPane=new JScrollPane();
scrollPane.getViewport().add(htmlOutputPane);
add("South",scrollPane);
}
catch(MalformedURLException err)
{ //etc etc...
 
maateen ashraf
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u cann't write to the server side in any file or even cannt
create any new file
cuz of the security restrictions of the browser on client side
so u have to either
let ur applet signed
or
set ur own security policy for the browser but this cant work cuz every browser has its own security policy which is set by manufacture of the VM
so the only way is to make ur applet signed
let me know what type of exceptions & errors r u getting
or
elaborate ur requirment
so as i can tell u some other solution..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic