admin/member/Modify.java > MODEL2

본문 바로가기
사이트 내 전체검색

MODEL2

admin/member/Modify.java

페이지 정보

profile_image
작성자 관리자
댓글 0건 조회 455회 작성일 23-03-18 22:13

본문

package admin.member;


import java.io.IOException;

import java.io.PrintWriter;


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.AdminMemberDAO;

import model.Member;


@WebServlet("/admin/member/modify")

public class Modify extends HttpServlet {

private static final long serialVersionUID = 1L;


    public Modify() {

        super();

    }


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

String id = request.getParameter("id");

AdminMemberDAO dao = new AdminMemberDAO();

Member member = dao.oneMember(id);

request.setAttribute("m", member);

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

dis.forward(request, response);

}


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

request.setCharacterEncoding("utf-8");

Member m = new Member();


m.setId(request.getParameter("mb_id"));

m.setPass(request.getParameter("mb_pass"));

m.setName(request.getParameter("mb_name"));

m.setAge(Integer.parseInt(request.getParameter("mb_age")));

m.setGender(request.getParameter("mb_gender"));

m.setEmail(request.getParameter("mb_email"));

m.setMemo(request.getParameter("mb_memo"));

AdminMemberDAO dao = new AdminMemberDAO();

dao.updateMember(m);

response.setContentType("text/html; charset=utf-8");

PrintWriter out = response.getWriter();


out.print("<script>");

out.print("opener.location.reload();"); //부모창 새로고침

out.print("self.close();"); //자식창 닫기

out.print("</script>");

}


}


추천0

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

사이트 정보

공지사항
자유게시판
질문답변
1:1문의

 

별명 : 터푸가위
주소 : 부산시 동래구 명장로20번길 90
대표 : 박규태
메일 : dancepkt@******.com

접속자집계

오늘
72
어제
132
최대
10,760
전체
269,220
Copyright © dancePKT . All rights reserved.