资源简介
数据库综合实习作业,C/S,qt写的前台myeclipse写的服务器(无前台代码)
代码片段和文件信息
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“);//设置应答内容,字体编码
request.setCharacterEncoding(“utf-8“);
response.setCharacterEncoding(“utf-8“);
//PrintWriter 基于字符的输出流,可以输出字符或字符串整型等数据。输出的目标可以是磁盘文件、其他输出流
//从response获得字符流 ,out由web容器创建
PrintWriter out = response.getWriter();
//获得客户端请求参数
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转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转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转int
flag = Integer.parseInt(Cdao.AddChargeInfo(cidwfeeefeegfee
mfeeofeepdateispay));
} catch (NumberFormatException e) {//可能出现非数异常
e.printStackTrace();
}
if(flag == 1)//插入成功
{
out.print(“successful!“);//发送消息至客户端
}
else//插入失败
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 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个文件信息
- 上一篇:一键复制粘贴工具V2.2.exe
- 下一篇:基于OpenGL的B样条曲线曲面的绘制
评论
共有 条评论