admin.category/CategoryWrite.java > MODEL2

본문 바로가기

사이트 내 전체검색

뒤로가기 MODEL2

admin.category/CategoryWrite.java

페이지 정보

작성자 관리자 작성일 23-03-19 10:56 조회 535 댓글 0

본문

package admin.category;


import java.io.IOException;


import javax.servlet.RequestDispatcher;

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 dao.CategoryDAO;

import model.Category;


@WebServlet("/admin/category/write")

public class CategoryWrite extends HttpServlet {

private static final long serialVersionUID = 1L;


    public CategoryWrite() {

        super();

    }

    

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

RequestDispatcher dis = request.getRequestDispatcher("write.jsp");

dis.forward(request, response);

}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

request.setCharacterEncoding("utf-8");

Category c = new Category();

c.setCa_id(request.getParameter("ca_id"));

c.setCa_name(request.getParameter("ca_name"));

c.setCa_use(request.getParameter("ca_use"));

CategoryDAO dao = new CategoryDAO();

dao.insertCategory(c);

response.sendRedirect("list");

}


}


추천0

댓글목록 0

등록된 댓글이 없습니다.


Copyright © dancePKT. All rights reserved.
PC 버전으로 보기