Package cn.chen.servlet

Source Code of cn.chen.servlet.AddConsumeAction

package cn.chen.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.chen.core.TimeHelper;
import cn.chen.dao.ConsumeDAO;
import cn.chen.domain.Consume;
/**
* �������Ѵ�����
* Desc:
* Author:waitfox@qq.com
* Date:2013-4-30 ����7:50:25
*/
@WebServlet("/addc")
public class AddConsumeAction extends HttpServlet {

  private static final long serialVersionUID = 1L;
 
  protected void doGet(HttpServletRequest request,
      HttpServletResponse response) throws ServletException, IOException {
  }
  protected void doPost(HttpServletRequest request,
      HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("text/html; charset=UTF-8");
    String title = request.getParameter("ctitle");
    float money=Float.parseFloat(request.getParameter("cmoney"));
    int type=Integer.parseInt(request.getParameter("ctype"));
    String detail=request.getParameter("cdetail");
    String date=request.getParameter("cdate");
    Consume c=new Consume();
    c.setTitle(title);
    c.setMoney(money);
    c.setDetail(detail);
    c.setTid(type);
    c.setDate(TimeHelper.strtoDate(date, "yyyy-MM-dd HH:mm"));
    ConsumeDAO consumeDAO=new ConsumeDAO();
    consumeDAO.addConsume(c);
    //response.sendRedirect("IndexAction");
    PrintWriter writer = response.getWriter();
    writer.print("��ӳɹ�");
  }

}
TOP

Related Classes of cn.chen.servlet.AddConsumeAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.