Text File Access on school server help!!!!

I am writing a poll applet for my school website and this is what i have:

import javax.swing.*;

import java.io.*;

import java.util.*;

import java.awt.*;

import java.applet.*;

import java.awt.event.*;

//import java.net.URL;

public class Poll extends Applet implements ActionListener

{

static final long serialVersionUID=64154651;

private String input;

private BufferedReader inputStream;

private int option1=0;

private int option2=0;

private int option3=0;

public Poll()

{

}

public void start()

{

setLayout(new GridLayout(3,1));

input=JOptionPane.showInputDialog(null,"Enter your school ID");

Button choice1=new Button("1:Ben is cool");

choice1.setActionCommand("1");

choice1.addActionListener(this);

add(choice1);

Button choice2=new Button("2:Ben is Sweet");

choice2.setActionCommand("2");

choice2.addActionListener(this);

add(choice2);

Button choice3=new Button("3:Ben is Nerdy");

choice3.setActionCommand("3");

choice3.addActionListener(this);

add(choice3);

setVisible(true);

//while(true);

}

public void stop()

{

}

public void actionPerformed(ActionEvent e)

{

String action=e.getActionCommand();

//JOptionPane.showMessageDialog(null,"Action");

try

{

inputStream = new BufferedReader(new FileReader("poll1.txt"));

PrintWriter pw=new PrintWriter(new FileOutputStream("poll3.txt"));

String line= inputStream.readLine();

StringTokenizer st;

while(line!=null)

{

pw.println(line);

st= new StringTokenizer(line);

switch(st.nextToken().charAt(0))

{

case '1':option1++;

break;

case '2':option2++;

break;

case '3':option3++;

break;

}

line=inputStream.readLine();

}

if(action.equals("1"))

{

pw.println("1 "+input);

JOptionPane.showMessageDialog(null,"You voted Ben is cool");

}

if(action.equals("2"))

{

pw.println("2 "+input);

JOptionPane.showMessageDialog(null,"You voted Ben is sweet");

}

if(action.equals("3"))

{

pw.println("3 "+input);

JOptionPane.showMessageDialog(null,"You voted Ben is nerdy");

}

JOptionPane.showMessageDialog(null,"Votes for choice 1: "+option1+"\nVotes for choice 2: "+option2+"\nVotes for choice 3: "+option3);

JOptionPane.showMessageDialog(null,"Thank you for your opinion!");

pw.close();

inputStream.close();

inputStream = new BufferedReader(new FileReader("poll3.txt"));

pw=new PrintWriter(new FileOutputStream("poll1.txt"));

line= inputStream.readLine();

while(line!=null)

{

pw.println(line);

line=inputStream.readLine();

}

pw.close();

}

catch(FileNotFoundException ex)

{

JOptionPane.showMessageDialog(null,"File poll.txt not found.");

System.out.println("File poll1.txt not found.");

}

catch(IOException ex)

{

JOptionPane.showMessageDialog(null,"Error reading from file message.txt.");

System.out.println("Error reading from file message.txt.");

}

catch(Exception ex)

{

JOptionPane.showMessageDialog(null,ex.toString());

}

destroy();

System.exit(0);

}

public static void main(String[] args)

{

Poll p= new Poll();

p.start();

}

}

When I run the applet on the local folder offline in eclipse applet viewer, it works, when I put it on a website, I get a security exception saying that I cant read poll1.txt. How do I read and write to text files that will be up on the same ftp as the class file?

[3839 byte] By [benmorsea] at [2007-10-3 4:23:39]
# 1

> When I run the applet on the local folder offline in

> eclipse applet viewer, it works, when I put it on a

> website, I get a security exception saying that I

> cant read poll1.txt.

Think about it, you're trying to read a file on someone else's machine. That's a super mega security violation.

SoulTech2012a at 2007-7-14 22:25:59 > top of Java-index,Desktop,Core GUI APIs...
# 2
So there is no way to include to text files in the jar or anything?
benmorsea at 2007-7-14 22:25:59 > top of Java-index,Desktop,Core GUI APIs...
# 3
Oh you can do what you want, but it involves compromising the security of the other machine and I'm not going to recommend that.
SoulTech2012a at 2007-7-14 22:25:59 > top of Java-index,Desktop,Core GUI APIs...
# 4
ok then, how do other online poll applets work? Can I tweak this to use mySQL? We do have a mySQL server but im not familiar with the java code to access the database. I have login and password information.
benmorsea at 2007-7-14 22:25:59 > top of Java-index,Desktop,Core GUI APIs...
# 5
Yes, you can do Applet to Servlet communication and the Servlet can write the data to the db. But that still won't solve the problem you have which is you want to read files off a remote computer.
SoulTech2012a at 2007-7-14 22:25:59 > top of Java-index,Desktop,Core GUI APIs...