请大家帮忙看看为什么这句出错说需要标示符
如题,
请高手帮帮忙,自己java还在学习中...
代码就是这些:
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class buttonrun implements ActionListener {
public buttonrun() {
}
Button b= new Button("yes");
b.addActionListener(this); -------->老是出错说这句需要标识符,为什么呢?我实在想不通,希望高手能够指点一下!
public void actionPerformed(ActionEvent e)
{ try{
Runtime.getRuntime().exec("C:\\Tomcat\\apache-tomcat-5.5.27\\apache-tomcat-5.5.27\\webapps\\gamefiles\\claaaa.exe ");
}
catch(Exception e)
{
}
}
public static void main(String []args)
{
buttonrun a =new buttonrun();
a.actionPerformed();
}
}
还有就是程序里面写的对吗?我的想法是:这是JSP里的一个javabean,通过点击一个按钮,实现调用一个外部程序的作用
我的JSP页面上有一个按钮,通过这个按钮调用这个bean里的方法,我该怎么写好呢?是写在onclink里吗?希望大家能指点我一下,万分感谢!
<input name="button1" type="button" value="gameshow" onclick="??"/>