findpswdbean.java
来自「maximo是全球著名的资产管理软件」· Java 代码 · 共 61 行
JAVA
61 行
package psdi.webclient.beans.signature;
import java.io.UnsupportedEncodingException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import psdi.mbo.MboRemote;
import psdi.server.MXServer;
import psdi.util.MXException;
import psdi.webclient.system.beans.AppBean;
import psdi.webclient.system.controller.Utility;
public class FindPswdBean extends AppBean {
public int submit() throws MXException, RemoteException {
String password = "";
MboRemote mboremote = getMbo();
password = getPassword(mboremote.getString("loginid"));
if (!"".equals(password))
Utility.showMessageBox(sessionContext.getCurrentEvent(), "signature", "passwordIs", new String[]{password});
return 1;
}
public String getPassword(String loginid) throws RemoteException,
MXException {
Connection conn = null;
PreparedStatement pst = null;
String password = "";
try {
conn = MXServer.getMXServer().getDBManager().getSystemConnection();
String sql = "select password from maxuser where loginid='" + loginid
+ "'";
pst = conn.prepareStatement(sql);
ResultSet rs = pst.executeQuery();
while (rs.next()) {
byte pwd[] = rs.getBytes("password");
CustMXCipherX cipher = new CustMXCipherX(getMXSession()
.getMXServerRemote());
byte[] realPwd = cipher.decData(pwd);
password = new String(realPwd, "ISO-8859-1");
}
} catch (SQLException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} finally {
if (pst != null)
try {
pst.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return password.trim();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?