当前位置:编程学习 > JAVA >>

用JAVA,Eclipse实现成绩管理系统用HTML写怎么弄

要求有界面显示实现成绩修改,成绩查询,成绩分析,成绩数据导出功能用HTML做 --------------------编程问答-------------------- 搭建个web项目,实现想要的功能 --------------------编程问答-------------------- 那你用nodeJs 做吧 顺便学习学习 后台js代码 --------------------编程问答-------------------- 在网上搜一下,好多可以参考 --------------------编程问答-------------------- import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.applet.*;
public class studentgl extends Applet implements ActionListener{
Label lid,lname,lphone;
  TextField a,b,c;
  Button binsert,bselect,bdelete;
  TextArea msg;
  Connection cn;
PreparedStatement ps;
String sql;
Statement stmt;
ResultSet rs;
public void init(){
lid=new Label("学号");lname=new Label("姓名");lphone=new Label("电话"); msg=new TextArea(8,30);
a=new TextField(10);b=new TextField(10);c=new TextField(10);
binsert=new Button("添加");bselect=new Button("查询");bdelete=new Button("删除");
add(lid);
add(a);
add(lname);
add(b);
add(lphone);
add(c);
add(binsert);
add(bselect);
add(bdelete);
add(msg);
msg.setEditable (false);
binsert.addActionListener(this);
binsert.setActionCommand("insert");
bselect.addActionListener(this);
bselect.setActionCommand("select");
bdelete.addActionListener(this);
bdelete.setActionCommand("delete");

}

public void actionPerformed(ActionEvent e)
{   try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:stu_access");}
catch(Exception e2){msg.setText("连接错误");}
if(e.getActionCommand().equals("insert")){
try{

stmt=cn.createStatement();
    sql="insert into student values('"+a.getText()+"','"+b.getText()+"','"+c.getText()+"')";
    stmt.executeUpdate(sql);
    stmt.close();cn.close();
    msg.setText("插入成功!");a.setText("");b.setText("");c.setText("");
    cn.close ();
    }
    catch(Exception e1){msg.setText("插入错误!");a.setText("");b.setText("");c.setText("");}
    }
   if(e.getActionCommand().equals("select")){
    String h="",h1="";
    try{
    Statement stmt=cn.createStatement();
    try{

    rs=stmt.executeQuery("SELECT *FROM student where a="+a.getText()+"");
   h1="";
    while(rs.next())
    {
    h1=h1+rs.getInt("a")+"  "+rs.getString("b")+"  "+rs.getInt("c")+"   "+"\n\n";
    }
    if(h1.equals("")) h1="按学号没有查询到数据!\n\n\n\n";
    else h1="按学号查询数据:\n\n"+h1+"\n";
    h=h+h1;
   
    }
    catch(Exception e1){h=h+"按学号没有查询到数据!\n\n\n\n";
    }
    try{
h1="";
    rs=stmt.executeQuery("SELECT *FROM student  where b='"+b.getText()+"'");
    while(rs.next())
    {
    h1=h1+rs.getInt("a")+"  "+rs.getString("b")+"  "+rs.getInt("c")+"   "+"\n\n";
    }
    if(h1.equals("")) h1="按姓名没有查询到数据!\n\n\n\n";
    else h1="按姓名查询数据:\n\n"+h1+"\n";
    h=h+h1;
    }
    catch(Exception e2){h=h+"按姓名没有查询到数据!\n\n\n\n";}
    try{
     rs=stmt.executeQuery("SELECT *FROM student  where c="+c.getText()+"");
    h1="";
    while(rs.next())
    {
    h1=h1+rs.getInt("a")+"  "+rs.getString("b")+"  "+rs.getInt("c")+"   "+"\n\n";
    }
    if(h1.equals("")) h1="按手机号没有查询到数据!\n\n\n\n";
    else h1="按手机号查询数据:\n\n"+h1+"\n";
    h=h+h1;
    }
    catch(Exception e3){h=h+"按手机号没有查询到数据!\n\n\n\n";
    }
    msg.setText(h);
    cn.close();
    }
    catch(Exception e3){ msg.setText("查询数据有误!");
a.setText("");
b.setText("");
c.setText("");
a.requestFocus();}
   }
   if(e.getActionCommand().equals("delete")){
    try{stmt=cn.createStatement();}
    catch(Exception e7){}
    try{
stmt.executeUpdate("delete FROM student where a="+a.getText()+"");
msg.setText("删除成功!");
cn.close ();
}
    catch(Exception e8){msg.setText("删除失败!");}
    try{
stmt.executeUpdate("delete *FROM student where b='"+b.getText()+"'");
msg.setText("删除成功!");
cn.close ();
}
    catch(Exception e9){msg.setText("删除失败!");}
    try{
stmt.executeUpdate("delete *FROM student where c="+c.getText()+"");
msg.setText("删除成功!");
cn.close ();
}
    catch(Exception e10){msg.setText("删除失败!");}
    }
  }
  
}

        
--------------------编程问答--------------------

            <html>
<head>
<title>学生管理</title>
</head>
<body>
<hr>
<applet
code=text
width=500
height=200>

</applet>
<hr>
</body>
</html>

        
--------------------编程问答--------------------

            自己桥接个数据库,这是我上学期老师让做的学生管理系统  你修改下就可以了
        
补充:Java ,  Java SE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,