permaculture playing cards*
The moose likes Java in General and the fly likes security errors in Applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "security errors in Applets" Watch "security errors in Applets" New topic
Author

security errors in Applets

rahul karwal
Ranch Hand

Joined: Oct 26, 2001
Posts: 73
Hi ppl,
i am having problem when i run this applet its giving me a security Errors and saying errors such as permision denied to write to a file. What i am actually trying to here get user's name, last name, email address and write that to a file and want to send the file to the server... but connecting to server is still needed to be coded but i am having problem with creating a fils i dont know so can anyone please help me or is there any better way to do this work ie another way rather than applets ...
thanks

import java.io.*;
import java.io.File;
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.util.*;
public class myapplet extends Applet implements ActionListener,TextListener {
TextField fname;
Panel dpanal;
Label fnamelabel;
Label lnamelabel;
TextField lname ;
Label emaillabel;
TextField email;
Label space;
Label note;
Label fevent;
Checkbox firstevent;
Label sevent;
Checkbox secondevent;
Label tevent;
Checkbox thirdevent;
Label foevent;
Checkbox forthevent;
Label submitlabel;
Button submmitbutton;
String firstNameText="";
String secondNametext="";
String emailtext ="dumb";
public void init(){

dpanal = new Panel();
fnamelabel = new Label("Please Enter Your First Name");
fname = new TextField(10);
fname.addTextListener(this);
lnamelabel = new Label("Please Enter Your Last Name");
lname = new TextField(10);
lname.addTextListener(this);
emaillabel = new Label("Please Enter Your E-mail Address");
email = new TextField(10);
email.addTextListener(this);
space = new Label();
note = new Label("Please Click As Many Events You Are Interested In");
fevent = new Label("");
firstevent = new Checkbox("Baseball");
sevent = new Label("");
secondevent = new Checkbox("Cricket");
tevent = new Label("");
thirdevent = new Checkbox("Football");
foevent = new Label("");
forthevent = new Checkbox("Tennis");
submitlabel = new Label("");
Button submmitbutton = new Button("Submit");
submmitbutton.addActionListener(this);

dpanal.setLayout(new GridLayout(9,9));
dpanal.add(fnamelabel);
dpanal.add(fname);
dpanal.add(lnamelabel);
dpanal.add(lname);
dpanal.add(emaillabel);
dpanal.add(email);
dpanal.add(space);
dpanal.add(note);
dpanal.add(fevent);
dpanal.add(firstevent);
dpanal.add(sevent);
dpanal.add(secondevent);
dpanal.add(tevent);
dpanal.add(thirdevent);
dpanal.add(foevent);
dpanal.add(forthevent);
dpanal.add(submitlabel);
dpanal.add(submmitbutton);
submmitbutton.setBackground(Color.lightGray);
setBackground(Color.white);
add(dpanal);

}


public void actionPerformed(ActionEvent e) {

print();
clearTextfield();
createFile();


}

public void textValueChanged(TextEvent e){

firstNameText = fname.getText();
secondNametext = lname.getText();
emailtext = email.getText();
}

public void print(){

System.out.println(firstNameText);
System.out.println(secondNametext);
System.out.println(emailtext);
}

public void clearTextfield(){

fname.setText("");
lname.setText("");
email.setText("");
System.out.println("Text fields cleared");
}

public void createFile() {

File file = new File(emailtext);

try{

file.createNewFile();
}
catch(IOException e1){
System.out.println("error occured"+e1);
}


System.out.println("after create method");
boolean cheak= file.exists();
System.out.println(cheak);

}




}
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Just answered this in Intermediate. Sean, can you close this thread here? Aziz, will you please not crosspost? Thanks.
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: security errors in Applets
 
Similar Threads
swing applet help
How to embed JavaFX 2.0 application with jsp (to deploy it on server)
Help please.
Security Errors
security problem in applets