可是我把它改写成一个小应用程序后,在IE中时,提交留言不成功啊.据说是什么JAVA的安全特性.
谁能帮我具体的讲讲啊,,我会非常谢谢你的.
这个不是代码问题吧 import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*;import java.applet.*; //姓名面板 class name extends JPanel {JLabel label; JTextField text; public void name() {label=new JLabel("姓名"); text=new JTextField(10); add(label);add(text); }} //性别面板 class sex extends JPanel {JLabel label; JComboBox choice; public void sex() {label=new JLabel("姓别"); String[] s={"男","女","不想说"}; choice=new JComboBox(s); add(label);add(choice); }} //用户看法面板 class advice extends JPanel {JLabel label; JRadioButton b1,b2,b3,b4; ButtonGroup group; public void advice() {label=new JLabel("你的看法"); b1=new JRadioButton("非常好");b2=new JRadioButton("很好"); b3=new JRadioButton("一般");b4=new JRadioButton("不好"); group=new ButtonGroup(); group.add(b1);group.add(b2);group.add(b3);group.add(b4); add(label);add(b1);add(b2);add(b3);add(b4); }} //用户议建区 class say extends JPanel {JLabel label; JTextArea text; public void say() {label=new JLabel("你填写你的议建"); text=new JTextArea(10,10); setLayout(new BorderLayout()); add(label,BorderLayout.NORTH); add(text,BorderLayout.SOUTH); }} //按钮区 class button extends JPanel {JButton button1,button2; void button() {button1=new JButton("确定"); button2=new JButton("取消"); add(button1);add(button2); }} //主功能主类 public class all extends JApplet implements ActionListener {say say1;name name1;button b; public void init() {//JFrame frame=new JFrame("留言板"); Container con=getContentPane(); JPanel panel=new JPanel();//主面板 panel.setBorder(BorderFactory.createTitledBorder("意见栏"));//设置主面板的标题 panel.setLayout(new BoxLayout(panel,BoxLayout.Y_AXIS));//设置主面板的布局 name1=new name();name1.name(); sex sex1=new sex();sex1.sex(); advice advice1=new advice();advice1.advice(); say1=new say();say1.say(); b=new button();b.button(); panel.add(name1);panel.add(sex1);panel.add(advice1);panel.add(say1);panel.add(b); con.add(panel);
b.button1.addActionListener(this); b.button2.addActionListener(this);
//frame.pack(); //frame.addWindowListener(new WindowAdapter(){public void windowClosing//(WindowEvent e){System.exit(0);}}); //frame.show(); } public void actionPerformed(ActionEvent e) {String s; if(e.getSource()==b.button1) {s="用户姓名:"+name1.text.getText()+" "+"用户意见:"+say1.text.getText(); try { FileOutputStream chars=new FileOutputStream("msg.txt"); Writer out=new OutputStreamWriter(chars); out.write(s); out.close(); } catch(IOException ee) {System.out.println("文件打开错误");} } if(e.getSource()==b.button2) {say1.text.setText("");name1.text.setText("");}
}
}