public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { mForm = (PowerForm) form; if (mForm.getId() != null && !mForm.getId().equals("")) getDepartData(); getOtherData(request); return (mapping.getInputForward()); }
public void getDepartData() { Connection mConn = null; Statement mStmt = null; ResultSet mRs = null; try { mConn = (new CEgovDB()).getConnection(); mStmt = mConn.createStatement(); mRs = mStmt.executeQuery("SELECT * FROM T_POWER WHERE ID='" + mForm.getId() + "'"); if (mRs.next()) { PropertiesCopy.copyProperties(mForm, mRs); } } catch (Exception e) { e.printStackTrace(); } finally { try { if (mRs != null) mRs.close(); if (mStmt != null) mStmt.close(); if (mConn != null) mConn.close(); } catch (SQLException e) { } } }