java项目packageproject.action.dialogAction;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjavax.swing.JOptionPane;importproject.dao.common.DbException;importproject.dao.dataDao.LoginInfoDao;importproject.dao.dataDaoImpl.LoginInfoDaoImpl;importproject.view.dialog.AddLoginInfoDialog;importproject.vo.LoginInfoVo;/***添加登录账号action**@authorAdministrator**/publicclassAddLoginInfoActionimplementsActionListener{privateAddLoginInfoDialogdialog;publicAddLoginInfoAction(AddLoginInfoDialogdialog){this.dialog=dialog;}publicvoidactionPerformed(ActionEvente){Stringname=e.getActionCommand();if(name.equals("确定")){//检验输入是否正确if(dialog.checkInputValue()){LoginInfoDaodao=null;LoginInfoVovo=null;try{//获得界面输入信息vo=dialog.getInputInfo();Stringconfirm=dialog.getConfirm();if(vo.getLog_pwd().equals(confirm)){dao=newLoginInfoDaoImpl();if(dao.insertLoginInfo(vo)){//打印提示信息JOptionPane.showMessageDialog(null,"添加登录人员成功","提示信息",JOptionPane.YES_OPTION);dialog.dispose();}else{//打印提示信息JOptionPane.showMessageDialog(null,"添加登录人员失败","提示信息",JOptionPane.YES_OPTION);}}else{//如果密码确认输入错误,打印提示信息JOptionPane.showMessageDialog(null,"密码确认错误,请重新输入","提示信息",JOptionPane.YES_OPTION);}}catch(DbExceptionex){JOptionPane.showMessageDialog(null,ex.getMessage(),"提示信息",JOptionPane.YES_OPTION);}}else{JOptionPane.showMessageDialog(null,"请确认输入是否完整正确","提示信息",JOptionPane.YES_OPTION);}}elseif(name.equals("取消")){dialog.dispose();}}}
1