read/write to file in java applet

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: read/write to file in java applet

  1. #1
    Join Date
    Aug 2005

    Unhappy read/write to file in java applet

    last time, i have read in the internet that java applet don't allow the users to read/write to file...but i found this one website that teaches how to open or write to file in java applet....

    after i follow the instruction, 2 files created which is TicketInterface.crt and TicketInterface.jar (i have class called TicketInterface which extends JApplet)

    besides that, i have 2 classes which are Admin and User...The User class have some attributes and methods which related to Write and Read Files (BufferedReader...BufferedWriter...something like that)....The Admin class don't have any of the attributes or methods which related to Write or Read Files...The TicketInterface class will call some of the methods from the User class as well as Admin class....

    the problem is i still can't open or write to file...Supposely, the TicketInterface class will call the method from User class so that it can write or read to file...

    this is some of the portion taken from User class :-

    	/////////////////////return LOGIN USER TRUE FALSE////////////////////////////////////
    	public boolean LoginUser() throws IOException 
    		BufferedReader inputusername = new BufferedReader (new FileReader("username.txt"));
    		BufferedReader inputpassword = new BufferedReader (new FileReader("password.txt"));
    		while((UsernameArray[i] = inputusername.readLine()) != null)
    				if ((UsernameArray[i]).equals (Username))
    					flag = true;
    				flag = false;
    		while((PasswordArray[i] = inputpassword.readLine()) != null)
    				if ((PasswordArray[i]).equals (Password))
    					flag2 = true;
    				flag2 = false;
    		if (flag == true && flag2 == true)
    			return true;
    		return false;
    this is some of the portion taken from TicketInterface class :-

     if (e.getSource() == OkPassLoginUser) // call OK button for PASSWORD LOGIN USER
          PasswordLoginUser = PassLoginUser.getText();
          	User u2 = new User(UsernameLoginUser, PasswordLoginUser);
          	flag = u2.LoginUser();
          		if (flag == true)
      	  catch (IOException ex)
    there is a screenshot after i sign my applet (after i follow the instruction from the above website)...i also attach the files which are created after i follow the instruction from the above website
    Attached Files Attached Files

Similar Threads

  1. How long before the next version??
    By _CAG in forum .NET
    Replies: 146
    Last Post: 08-12-2002, 10:40 PM
  2. Java Applet to display the log file
    By Calis in forum Java
    Replies: 3
    Last Post: 08-05-2002, 02:50 PM
  3. .NET vs. Enterprise Java: Who's Got Better Security?
    By Glen Kunene in forum Talk to the Editors
    Replies: 17
    Last Post: 03-23-2002, 12:43 AM
  4. Java Applet won't work via browsers
    By Graham in forum Java
    Replies: 1
    Last Post: 02-20-2001, 01:47 AM
  5. how to read text file using JAVA...??
    By Billy in forum Java
    Replies: 3
    Last Post: 02-02-2001, 08:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center