显示注册成功,也连接成功了数据库,就是数据库里没有更新数据

package edu.jmi.xyh.view;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Window;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.Font;

import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JButton;

import edu.jmi.xyh.bean.Student;
import edu.jmi.xyh.dao.StudentDao;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class RegisterView extends JFrame {

private JPanel contentPane;
private JTextField txID;
private JTextField txName;
private JPasswordField txPw;



/**
 * Launch the application.
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                RegisterView frame = new RegisterView();
                frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

/**
 * Create the frame.
 */
public RegisterView() {
    setTitle("\u5B66\u751F\u4FE1\u606F\u6CE8\u518C");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 361, 327);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel label = new JLabel("\u5B66 \u751F \u4FE1 \u606F \u6CE8 \u518C");
    label.setFont(new Font("宋体", Font.PLAIN, 20));
    label.setBounds(109, 10, 197, 27);
    contentPane.add(label);

    JLabel lblId = new JLabel("\u7528 \u6237 ID\uFF1A");
    lblId.setBounds(78, 47, 73, 15);
    contentPane.add(lblId);

    JLabel label_2 = new JLabel("\u7528 \u6237 \u540D\uFF1A");
    label_2.setBounds(78, 85, 73, 15);
    contentPane.add(label_2);

    JLabel lblNewLabel = new JLabel("\u5BC6    \u7801\uFF1A");
    lblNewLabel.setBounds(78, 124, 73, 15);
    contentPane.add(lblNewLabel);

    txID = new JTextField();
    txID.setBounds(157, 47, 110, 21);
    contentPane.add(txID);
    txID.setColumns(10);

    txName = new JTextField();
    txName.setBounds(161, 82, 106, 21);
    contentPane.add(txName);
    txName.setColumns(10);

    txPw = new JPasswordField();
    txPw.setBounds(161, 121, 106, 21);
    contentPane.add(txPw);

    JButton btnNewButton = new JButton("\u6CE8\u518C");
    btnNewButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //完成注册功能
            String id=txID.getText();
            if(id==null||id.length()==0||id.length()>20){
                JOptionPane.showMessageDialog(null, "ID输入不正确!");
            }
            //继续验证用户名和密码
            String pw=txPw.getText();
            String name=txName.getText();
            Student student=new Student();

            student.setStuId(id);
            student.setStuName(name);
            student.setStuPwd(pw);
            StudentDao studentDao=new StudentDao();
            int result=studentDao.save(student);
            if(result==0){
                JOptionPane.showMessageDialog(null, "注册成功!");
                RegisterView.this.dispose();
            }
            else{
                JOptionPane.showMessageDialog(null, "注册失败!");
            }
            System.out.println("id="+id+"pw="+pw);
        }
    });
    btnNewButton.setBounds(47, 183, 93, 23);
    contentPane.add(btnNewButton);

    JButton btnNewButton_1 = new JButton("\u9000\u51FA");
    btnNewButton_1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //生成一个对象
            MainView mainView = new MainView();
            //隐藏窗口
            RegisterView.this.setVisible(false);
            mainView.setVisible(true);
        }
    });
    btnNewButton_1.setBounds(194, 183, 93, 23);
    contentPane.add(btnNewButton_1);
}

public void setMainView(MainView mainView) {
    // TODO Auto-generated method stub

}

public void setID(Object id) {
    // TODO Auto-generated method stub

}

}

断点跟result呀,studentdao的代码呢

是不是没有提交操作conn.commit("true");

你需要刷新数据库啊 大哥