package idc.main.command;

import idc.model.IdcCmd;
import idc.model.IdcDAO;
import idc.model.IdcShareBoardDBDTO;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class IdcShareBoardModifyFormCmd implements IdcCmd
{
	IdcDAO dao;
	public IdcShareBoardModifyFormCmd()
	{
		dao = new IdcDAO();
	}
	
	//공용페이지 수정페이지
	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response)
	{
		IdcShareBoardDBDTO dto = new IdcShareBoardDBDTO();
		setDTO(dto, request);
		request.setAttribute("shareboardDB", dto);
	}
	private void setDTO(IdcShareBoardDBDTO dto, HttpServletRequest request)
	{
		dto.setContent(request.getParameter("content"));
		dto.setFilename(request.getParameter("filename"));
		dto.setId(request.getParameter("id"));
		dto.setNum(Integer.parseInt(request.getParameter("num")));
		dto.setTitle(request.getParameter("title"));
	}
}
