資源簡(jiǎn)介
數(shù)據(jù)庫(kù)綜合實(shí)習(xí)作業(yè),C/S,qt寫的前臺(tái)myeclipse寫的服務(wù)器(無(wú)前臺(tái)代碼)

代碼片段和文件信息
package?clientServlet;
import?java.io.IOException;
import?java.io.PrintWriter;
import?java.text.ParseException;
import?java.text.SimpleDateFormat;
import?java.util.Date;
import?javax.servlet.ServletException;
import?javax.servlet.http.HttpServlet;
import?javax.servlet.http.HttpServletRequest;
import?javax.servlet.http.HttpServletResponse;
import?entityDAO.ChargeDAOImpl;
import?entityDAO.CinfoDAOImpl;
import?implement.ChargeDAO;
import?implement.CinfoDAO;
public?class?AddChargeServlet?extends?HttpServlet?{
/**
?*?Constructor?of?the?object.
?*/
public?AddChargeServlet()?{
super();
}
/**
?*?Destruction?of?the?servlet.?
?*/
public?void?destroy()?{
super.destroy();?//?Just?puts?“destroy“?string?in?log
//?Put?your?code?here
}
/**
?*?The?doGet?method?of?the?servlet.?
?*
?*?This?method?is?called?when?a?form?has?its?tag?value?method?equals?to?get.
?*?
?*?@param?request?the?request?send?by?the?client?to?the?server
?*?@param?response?the?response?send?by?the?server?to?the?client
?*?@throws?ServletException?if?an?error?occurred
?*?@throws?IOException?if?an?error?occurred
?*/
public?void?doGet(HttpServletRequest?request?HttpServletResponse?response)?throws?ServletException?IOException?{
response.setContentType(“text/html;charset=utf-8“);//設(shè)置應(yīng)答內(nèi)容,字體編碼
request.setCharacterEncoding(“utf-8“);??
????response.setCharacterEncoding(“utf-8“);
????
????//PrintWriter?基于字符的輸出流,可以輸出字符或字符串整型等數(shù)據(jù)。輸出的目標(biāo)可以是磁盤文件、其他輸出流??
????//從response獲得字符流?,out由web容器創(chuàng)建??
PrintWriter?out?=?response.getWriter();
//獲得客戶端請(qǐng)求參數(shù)
int?cid?=?Integer.parseInt(request.getParameter(“cid“));
//int?hid?=?Integer.parseInt(request.getParameter(“hid“));
//int?uid?=?Integer.parseInt(request.getParameter(“uid“));
String?w?=?request.getParameter(“wfee“);
String?ee?=?request.getParameter(“efee“);
String?g?=?request.getParameter(“gfee“);
String?m?=?request.getParameter(“mfee“);
String?o?=?request.getParameter(“ofee“);
String?p?=?request.getParameter(“pdate“);
String?ispay?=?request.getParameter(“ispay“);
//String轉(zhuǎn)double
double?wfee?=?Double.valueOf(w).doubleValue();
double?efee?=?Double.valueOf(ee).doubleValue();
double?gfee?=?Double.valueOf(g).doubleValue();
double?mfee?=?Double.valueOf(m).doubleValue();
double?ofee?=?Double.valueOf(o).doubleValue();
//String轉(zhuǎn)Date
Date?pdate?=?null;
try??
{??
SimpleDateFormat?sdf?=?new?SimpleDateFormat(“yyyy-MM-dd?“);
pdate?=?sdf.parse(p);
}??
catch?(ParseException?e)??
{??
????System.out.println(e.getMessage());??
}??
int?flag?=?0;
ChargeDAO?Cdao?=?new?ChargeDAOImpl();
try?{//String轉(zhuǎn)int
???flag?=?Integer.parseInt(Cdao.AddChargeInfo(cidwfeeefeegfee
???mfeeofeepdateispay));
}?catch?(NumberFormatException?e)?{//可能出現(xiàn)非數(shù)異常
????e.printStackTrace();
}
if(flag?==?1)//插入成功
{
out.print(“successful!“);//發(fā)送消息至客戶端
}
else//插入失敗
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????1697??2018-01-09?15:17??qt+myeclipse\intership\.classpath
?????文件????????443??2018-01-12?16:46??qt+myeclipse\intership\.myhibernatedata
?????文件???????1059??2018-01-05?08:34??qt+myeclipse\intership\.project
?????文件????????564??2018-01-05?08:34??qt+myeclipse\intership\.settings\.jsdtscope
?????文件????????364??2018-01-05?08:34??qt+myeclipse\intership\.settings\org.eclipse.jdt.core.prefs
?????文件????????486??2018-01-05?08:34??qt+myeclipse\intership\.settings\org.eclipse.wst.common.component
?????文件????????465??2018-01-05?09:59??qt+myeclipse\intership\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件?????????49??2018-01-05?08:34??qt+myeclipse\intership\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2018-01-05?08:34??qt+myeclipse\intership\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件???????4390??2018-01-09?13:09??qt+myeclipse\intership\src\clientServlet\AddChargeServlet.java
?????文件???????3756??2018-01-09?13:06??qt+myeclipse\intership\src\clientServlet\AddCinfoServlet.java
?????文件???????4075??2018-01-09?12:59??qt+myeclipse\intership\src\clientServlet\AddHinfoServlet.java
?????文件???????3822??2018-01-08?12:59??qt+myeclipse\intership\src\clientServlet\AddHmServlet.java
?????文件???????3952??2018-01-10?22:24??qt+myeclipse\intership\src\clientServlet\CheckAllServlet.java
?????文件???????4274??2018-01-09?22:40??qt+myeclipse\intership\src\clientServlet\CheckServlet.java
?????文件???????3770??2018-01-11?09:01??qt+myeclipse\intership\src\clientServlet\DeleteServlet.java
?????文件???????3410??2018-01-07?17:22??qt+myeclipse\intership\src\clientServlet\LoginServlet.java
?????文件???????3816??2018-01-10?00:51??qt+myeclipse\intership\src\clientServlet\UpdateHmServlet.java
?????文件???????2044??2018-01-12?16:42??qt+myeclipse\intership\src\entity\AbstractCharge.java
?????文件???????1968??2018-01-12?16:46??qt+myeclipse\intership\src\entity\AbstractClientInfo.java
?????文件???????2288??2018-01-05?10:40??qt+myeclipse\intership\src\entity\AbstractHm.java
?????文件???????2581??2018-01-05?10:41??qt+myeclipse\intership\src\entity\AbstractHouseInfo.java
?????文件???????1674??2018-01-12?16:42??qt+myeclipse\intership\src\entity\Charge.hbm.xm
?????文件????????481??2018-01-05?10:39??qt+myeclipse\intership\src\entity\Charge.java
?????文件???????1477??2018-01-12?16:46??qt+myeclipse\intership\src\entity\ClientInfo.hbm.xm
?????文件????????477??2018-01-05?10:40??qt+myeclipse\intership\src\entity\ClientInfo.java
?????文件????????587??2018-01-05?17:12??qt+myeclipse\intership\src\entity\DBConnection.java
?????文件???????1698??2018-01-05?10:40??qt+myeclipse\intership\src\entity\Hm.hbm.xm
?????文件????????581??2018-01-05?10:40??qt+myeclipse\intership\src\entity\Hm.java
?????文件???????1967??2018-01-05?10:41??qt+myeclipse\intership\src\entity\HouseInfo.hbm.xm
............此處省略69個(gè)文件信息
評(píng)論
共有 條評(píng)論