2013년 8월 11일 일요일

스트럿츠 멀티 게시판5. 사용자( 2 - 6 ) [Struts, Struts2, Struts Spring, StrutsFramework, Struts MVC, Struts게시판, 스프럿츠게시판, Struts Action, Struts DAO, struts교육, struts강좌, struts2교육, struts2강좌]

////////////// BoardForm.java //////////////////////

package board.model;

import org.apache.struts.action.ActionForm;
import org.apache.struts.upload.FormFile;

public class BoardForm extends ActionForm
{
        private String action = null;
        private String board_code = null;
        private String board_no = null;
        private String board_grade = null;
        private String write_date = null;
        private String title = null;
        private String hit = null;
        private String content_type = null;
        private String content = null;
        private FormFile file_name = null;
        private String member_id = null;
        private String current_page = null;
        private String is_search = null;
       
       
        /**
        * @return Returns the is_search.
        */
        public String getIs_search() {
                return is_search;
        }
        /**
        * @param is_search The is_search to set.
        */
        public void setIs_search(String is_search) {
                this.is_search = is_search;
        }
        /**
        * @return Returns the action.
        */
        public String getAction() {
                return action;
        }
        /**
        * @param action The action to set.
        */
        public void setAction(String action) {
                this.action = action;
        }
        /**
        * @return Returns the current_page.
        */
        public String getCurrent_page() {
                return current_page;
        }
        /**
        * @param current_page The current_page to set.
        */
        public void setCurrent_page(String current_page) {
                this.current_page = current_page;
        }
        /**
        * @return Returns the board_code.
        */
        public String getBoard_code() {
                return board_code;
        }
        /**
        * @param board_code The board_code to set.
        */
        public void setBoard_code(String board_code) {
                this.board_code = board_code;
        }
        /**
        * @return Returns the board_grade.
        */
        public String getBoard_grade() {
                return board_grade;
        }
        /**
        * @param board_grade The board_grade to set.
        */
        public void setBoard_grade(String board_grade) {
                this.board_grade = board_grade;
        }
        /**
        * @return Returns the board_no.
        */
        public String getBoard_no() {
                return board_no;
        }
        /**
        * @param board_no The board_no to set.
        */
        public void setBoard_no(String board_no) {
                this.board_no = board_no;
        }
        /**
        * @return Returns the content.
        */
        public String getContent() {
                return content;
        }
        /**
        * @param content The content to set.
        */
        public void setContent(String content) {
                this.content = content;
        }
        /**
        * @return Returns the content_type.
        */
        public String getContent_type() {
                return content_type;
        }
        /**
        * @param content_type The content_type to set.
        */
        public void setContent_type(String content_type) {
                this.content_type = content_type;
        }
       
        /**
        * @return Returns the file_name.
        */
        public FormFile getFile_name() {
                return file_name;
        }
        /**
        * @param file_name The file_name to set.
        */
        public void setFile_name(FormFile file_name) {
                this.file_name = file_name;
        }
        /**
        * @return Returns the hit.
        */
        public String getHit() {
                return hit;
        }
        /**
        * @param hit The hit to set.
        */
        public void setHit(String hit) {
                this.hit = hit;
        }
        /**
        * @return Returns the member_id.
        */
        public String getMember_id() {
                return member_id;
        }
        /**
        * @param member_id The member_id to set.
        */
        public void setMember_id(String member_id) {
                this.member_id = member_id;
        }
        /**
        * @return Returns the title.
        */
        public String getTitle() {
                return title;
        }
        /**
        * @param title The title to set.
        */
        public void setTitle(String title) {
                this.title = title;
        }
        /**
        * @return Returns the write_date.
        */
        public String getWrite_date() {
                return write_date;
        }
        /**
        * @param write_date The write_date to set.
        */
        public void setWrite_date(String write_date) {
                this.write_date = write_date;
        }
}


/////////////// BoardVO.java //////////////////////////
package board.model;


public class BoardVO
{
        private String board_code = null;
        private String board_no = null;
        private String board_grade = null;
        private String short_write_date = null;
        private String write_date = null;
        private String title = null;
        private String hit = null;
        private String content_type = null;
        private String content = null;
        private String file_name = null;
        private String member_id = null;
        private String is_search = null;
       
       
       
        /**
        * @return Returns the is_search.
        */
        public String getIs_search() {
                return is_search;
        }
        /**
        * @param is_search The is_search to set.
        */
        public void setIs_search(String is_search) {
                this.is_search = is_search;
        }
        /**
        * @return Returns the content_type.
        */
        public String getContent_type() {
                return content_type;
        }
        /**
        * @param content_type The content_type to set.
        */
        public void setContent_type(String content_type) {
                this.content_type = content_type;
        }
        /**
        * @return Returns the short_write_date.
        */
        public String getShort_write_date() {
                return short_write_date;
        }
        /**
        * @param short_write_date The short_write_date to set.
        */
        public void setShort_write_date(String short_write_date) {
                this.short_write_date = short_write_date;
        }
        /**
        * @return Returns the board_code.
        */
        public String getBoard_code() {
                return board_code;
        }
        /**
        * @param board_code The board_code to set.
        */
        public void setBoard_code(String board_code) {
                this.board_code = board_code;
        }
        /**
        * @return Returns the board_grade.
        */
        public String getBoard_grade() {
                return board_grade;
        }
        /**
        * @param board_grade The board_grade to set.
        */
        public void setBoard_grade(String board_grade) {
                this.board_grade = board_grade;
        }
        /**
        * @return Returns the board_no.
        */
        public String getBoard_no() {
                return board_no;
        }
        /**
        * @param board_no The board_no to set.
        */
        public void setBoard_no(String board_no) {
                this.board_no = board_no;
        }
        /**
        * @return Returns the content.
        */
        public String getContent() {
                return content;
        }
        /**
        * @param content The content to set.
        */
        public void setContent(String content) {
                this.content = content;
        }
        /**
        * @return Returns the file_name.
        */
        public String getFile_name() {
                return file_name;
        }
        /**
        * @param file_name The file_name to set.
        */
        public void setFile_name(String file_name) {
                this.file_name = file_name;
        }
        /**
        * @return Returns the hit.
        */
        public String getHit() {
                return hit;
        }
        /**
        * @param hit The hit to set.
        */
        public void setHit(String hit) {
                this.hit = hit;
        }
        /**
        * @return Returns the member_id.
        */
        public String getMember_id() {
                return member_id;
        }
        /**
        * @param member_id The member_id to set.
        */
        public void setMember_id(String member_id) {
                this.member_id = member_id;
        }
        /**
        * @return Returns the title.
        */
        public String getTitle() {
                return title;
        }
        /**
        * @param title The title to set.
        */
        public void setTitle(String title) {
                this.title = title;
        }
        /**
        * @return Returns the write_date.
        */
        public String getWrite_date() {
                return write_date;
        }
        /**
        * @param write_date The write_date to set.
        */
        public void setWrite_date(String write_date) {
                this.write_date = write_date;
        }
}

//////////////////// MemoDAO.java //////////////////////
package board.model;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import com.bitmechanic.sql.ConnectionPoolManager;

import multiboard.Util;
import multiboard.KKJLog;


public class MemoDAO
{
        Connection con=null;
    PreparedStatement pstmt=null;
    ResultSet rs = null;
   
    String sql = "";
       
    /*
    *                개요                :  꼬릿말  리스트
    *                작성일            :        2005-08-15       
    *                작성자        :        김길재
    *                수정자        :
    */
    public List list( String board_code ,
                              String board_no ,
                                  String board_grade ,
                                  String write_date )
    {
            List memoList = new ArrayList();
       
        try
                {
                con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
         
                sql  = "  SELECT BOARD_CODE , ";
            sql += "          BOARD_NO , ";
            sql += "          BOARD_GRADE , ";
            sql += "          WRITE_DATE , ";
            sql += "          MEMO_NO , ";
            sql += "          MEMBER_ID , ";
            sql += "          MEMO , ";
            sql += "          MEMO_TIME ";
            sql += "    FROM MEMO ";
            sql += "    WHERE BOARD_CODE = ? ";;
            sql += "      AND BOARD_NO = ? ";;
            sql += "      AND BOARD_GRADE = ? ";;
            sql += "      AND WRITE_DATE = ? ";;
            sql += " ORDER BY MEMO_NO DESC ";
           
            pstmt = con.prepareStatement(sql);
           
            pstmt.setString( 1 , board_code );
            pstmt.setInt( 2 , Integer.parseInt( board_no ) );
            pstmt.setInt( 3 , Integer.parseInt( board_grade ) );
            pstmt.setString( 4 , write_date );
           
            rs = pstmt.executeQuery();

            while(rs.next())
            { 
                MemoVO memo = new MemoVO();
                    memo.setBoard_code( rs.getString( "BOARD_CODE" ) );
                    memo.setBoard_no( Integer.toString( rs.getInt( "BOARD_NO" ) ) );
                    memo.setBoard_grade( Integer.toString( rs.getInt( "BOARD_GRADE" ) ) );
                    memo.setWrite_date( rs.getString( "WRITE_DATE" ) );
                    memo.setMemo_no( Integer.toString( rs.getInt( "MEMO_NO" ) ) );
                    memo.setMember_id( rs.getString( "MEMBER_ID" ) );
                    memo.setMemo( rs.getString( "MEMO" ) );
                    memo.setMemo_time( rs.getString( "MEMO_TIME" ) );
                    memoList.add( memo );
            }
            con.commit();
        }
        catch (Exception e)
                {
                try
                        {
                        con.rollback();
                        }
                catch( Exception e1 )
                        {}
                KKJLog.info( "//////////////////////////////////////////////" );
                KKJLog.info( "list Error : " + e.toString() );
                KKJLog.info( "//////////////////////////////////////////////" );
                return null;
        }
        finally
        {
                try
                {

                        if ( rs != null )
                                rs.close();
                        if ( pstmt != null )
                                pstmt.close();
                        if ( con != null )
                                con.close();
                }
                catch ( Exception ignore )
                {
                }
        }

        return memoList;
   
        }
   
    /*
    *                개요                :  꼬릿말 리턴
    *                작성일            :        2005-08-15       
    *                작성자        :        김길재
    *                수정자        :
    */
    public MemoVO view( String board_code ,
                                String board_no ,
                                    String board_grade ,
                                    String write_date ,
                                                String memo_no )
    {
            MemoVO memo = new MemoVO();
       
        try
                {
                con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
         
                sql  = "  SELECT BOARD_CODE , ";
            sql += "          BOARD_NO , ";
            sql += "          BOARD_GRADE , ";
            sql += "          WRITE_DATE , ";
            sql += "          MEMO_NO , ";
            sql += "          MEMBER_ID , ";
            sql += "          MEMO , ";
            sql += "          MEMO_TIME ";
            sql += "    FROM MEMO ";
            sql += "    WHERE BOARD_CODE = ? ";
            sql += "      AND BOARD_NO = ? ";
            sql += "      AND BOARD_GRADE = ? ";
            sql += "      AND WRITE_DATE = ? ";
            sql += "      AND MEMO_NO = ? ";
            sql += " ORDER BY MEMO_NO DESC ";
           
            pstmt = con.prepareStatement(sql);
           
            pstmt.setString( 1 , board_code );
            pstmt.setInt( 2 , Integer.parseInt( board_no ) );
            pstmt.setInt( 3 , Integer.parseInt( board_grade ) );
            pstmt.setString( 4 , write_date );
            pstmt.setInt( 5 , Integer.parseInt( memo_no ) );
           
            rs = pstmt.executeQuery();

            while(rs.next())
            { 
                    memo.setBoard_code( rs.getString( "BOARD_CODE" ) );
                    memo.setBoard_no( Integer.toString( rs.getInt( "BOARD_NO" ) ) );
                    memo.setBoard_grade( Integer.toString( rs.getInt( "BOARD_GRADE" ) ) );
                    memo.setWrite_date( rs.getString( "WRITE_DATE" ) );
                    memo.setMemo_no( Integer.toString( rs.getInt( "MEMO_NO" ) ) );
                    memo.setMember_id( rs.getString( "MEMBER_ID" ) );
                    memo.setMemo( rs.getString( "MEMO" ) );
                    memo.setMemo_time( rs.getString( "MEMO_TIME" ) );
            }
            con.commit();
        }
        catch (Exception e)
                {
                try
                        {
                        con.rollback();
                        }
                catch( Exception e1 )
                        {}
                KKJLog.info( "//////////////////////////////////////////////" );
                KKJLog.info( "list Error : " + e.toString() );
                KKJLog.info( "//////////////////////////////////////////////" );
                return null;
        }
        finally
        {
                try
                {

                        if ( rs != null )
                                rs.close();
                        if ( pstmt != null )
                                pstmt.close();
                        if ( con != null )
                                con.close();
                }
                catch ( Exception ignore )
                {
                }
        }

        return memo;
   
        }   
   
    /*
    *                개요                :  꼬릿말 쓰기
    *                작성일            :        2005-08-15       
    *                작성자        :        김길재
    *                수정자        :
    */
    public String insert( String board_code ,
                                  String board_no ,
                                  String board_grade ,
                                  String write_date ,
                                  String member_id ,
                                  String memo )
    {
            int max_no = 0;
            //해당 게시물의 최대 꼬릿말 번호를 셀렉트.
            max_no = max_no( board_code ,
                                    board_no ,
                                        board_grade ,
                                        write_date ) + 1;
           
            try
        {
                        con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
                        con.setAutoCommit(false);
                       
                        sql =  " INSERT INTO MEMO( BOARD_CODE , ";
                        sql += "                  BOARD_NO , ";
                        sql += "                  BOARD_GRADE , ";
                        sql += "                  WRITE_DATE , ";
                        sql += "                  MEMO_NO , ";
                        sql += "                  MEMBER_ID , ";
                        sql += "                  MEMO , ";
                        sql += "                  MEMO_TIME ) ";
                        sql += "            VALUES( ? , ";
                        sql += "                    ? , ";
                        sql += "                    ? , ";
                        sql += "                    ? , ";
                        sql += "                    ? , ";
                        sql += "                    ? , ";
                        sql += "                    ? , ";
                        sql += "                    TO_CHAR( SYSDATE , 'YYYY/MM/DD' ) ) ";
               
                        pstmt = con.prepareStatement(sql);
           
                        pstmt.setString( 1 , board_code );
                        pstmt.setString( 2 , board_no );
                        pstmt.setString( 3 , board_grade );
                        pstmt.setString( 4 , write_date );
                        pstmt.setInt( 5 , max_no );
                        pstmt.setString( 6 , member_id );
                        pstmt.setString( 7 , Util.uni2ksc( memo ) );
           
            pstmt.executeUpdate();

            con.commit();
               
                        return "success";
        }
                catch( Exception e )
                {
                try
                        {
                        con.rollback();
                        }
                catch( Exception e1 )
                        {}
                KKJLog.info( "//////////////////////////////////////////////" );
                KKJLog.info( "insert Error : " + e.toString() );
                KKJLog.info( "//////////////////////////////////////////////" );
                return "fail";
                }
        finally
        {
            try
            {
                    if ( rs != null )
                            rs.close();
                if ( pstmt != null )
                        pstmt.close();
                if ( con != null )
                        con.close();
            }
            catch ( Exception ignore )
            {
            }
   
        }
    }
   
    /*
    *                개요                :  꼬릿말 수정
    *                작성일            :        2005-08-15       
    *                작성자        :        김길재
    *                수정자        :
    */
    public String update( String board_code ,
                                  String board_no ,
                                  String board_grade ,
                                  String write_date ,
                                                  String memo_no ,
                                  String memo )
    {
            try
        {
                        con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
                        con.setAutoCommit(false);
                       
                        sql =  " UPDATE MEMO SET MEMO = ? ";


          & 




/////////////////// MemoForm.java ///////////////////////////

package board.model;

import org.apache.struts.action.ActionForm;

public class MemoForm extends ActionForm
{
        private String action = null;
        private String board_code = null;
        private String board_no = null;
        private String board_grade = null;
        private String write_date = null;
        private String current_page = null;
        private String memo_no = null;
        private String member_id = null;
        private String memo = null;
        private String memo_time = null;
       
       
       
        /**
        * @return Returns the current_page.
        */
        public String getCurrent_page() {
                return current_page;
        }
        /**
        * @param current_page The current_page to set.
        */
        public void setCurrent_page(String current_page) {
                this.current_page = current_page;
        }
        /**
        * @return Returns the action.
        */
        public String getAction() {
                return action;
        }
        /**
        * @param action The action to set.
        */
        public void setAction(String action) {
                this.action = action;
        }
        /**
        * @return Returns the board_code.
        */
        public String getBoard_code() {
                return board_code;
        }
        /**
        * @param board_code The board_code to set.
        */
        public void setBoard_code(String board_code) {
                this.board_code = board_code;
        }
        /**
        * @return Returns the board_grade.
        */
        public String getBoard_grade() {
                return board_grade;
        }
        /**
        * @param board_grade The board_grade to set.
        */
        public void setBoard_grade(String board_grade) {
                this.board_grade = board_grade;
        }
        /**
        * @return Returns the board_no.
        */
        public String getBoard_no() {
                return board_no;
        }
        /**
        * @param board_no The board_no to set.
        */
        public void setBoard_no(String board_no) {
                this.board_no = board_no;
        }
        /**
        * @return Returns the member_id.
        */
        public String getMember_id() {
                return member_id;
        }
        /**
        * @param member_id The member_id to set.
        */
        public void setMember_id(String member_id) {
                this.member_id = member_id;
        }
        /**
        * @return Returns the memo.
        */
        public String getMemo() {
                return memo;
        }
        /**
        * @param memo The memo to set.
        */
        public void setMemo(String memo) {
                this.memo = memo;
        }
        /**
        * @return Returns the memo_no.
        */
        public String getMemo_no() {
                return memo_no;
        }
        /**
        * @param memo_no The memo_no to set.
        */
        public void setMemo_no(String memo_no) {
                this.memo_no = memo_no;
        }
        /**
        * @return Returns the memo_time.
        */
        public String getMemo_time() {
                return memo_time;
        }
        /**
        * @param memo_time The memo_time to set.
        */
        public void setMemo_time(String memo_time) {
                this.memo_time = memo_time;
        }
        /**
        * @return Returns the write_date.
        */
        public String getWrite_date() {
                return write_date;
        }
        /**
        * @param write_date The write_date to set.
        */
        public void setWrite_date(String write_date) {
                this.write_date = write_date;
        }
}

//////////////////// MemoVO.java //////////////////////
package board.model;

public class MemoVO
{
        private String board_code = null;
        private String board_no = null;
        private String board_grade = null;
        private String write_date = null;
        private String memo_no = null;
        private String member_id = null;
        private String memo = null;
        private String memo_time = null;
       
       
        /**
        * @return Returns the board_code.
        */
        public String getBoard_code() {
                return board_code;
        }
        /**
        * @param board_code The board_code to set.
        */
        public void setBoard_code(String board_code) {
                this.board_code = board_code;
        }
        /**
        * @return Returns the board_grade.
        */
        public String getBoard_grade() {
                return board_grade;
        }
        /**
        * @param board_grade The board_grade to set.
        */
        public void setBoard_grade(String board_grade) {
                this.board_grade = board_grade;
        }
        /**
        * @return Returns the board_no.
        */
        public String getBoard_no() {
                return board_no;
        }
        /**
        * @param board_no The board_no to set.
        */
        public void setBoard_no(String board_no) {
                this.board_no = board_no;
        }
        /**
        * @return Returns the member_id.
        */
        public String getMember_id() {
                return member_id;
        }
        /**
        * @param member_id The member_id to set.
        */
        public void setMember_id(String member_id) {
                this.member_id = member_id;
        }
        /**
        * @return Returns the memo.
        */
        public String getMemo() {
                return memo;
        }
        /**
        * @param memo The memo to set.
        */
        public void setMemo(String memo) {
                this.memo = memo;
        }
        /**
        * @return Returns the memo_time.
        */
        public String getMemo_time() {
                return memo_time;
        }
        /**
        * @param memo_time The memo_time to set.
        */
        public void setMemo_time(String memo_time) {
                this.memo_time = memo_time;
        }
       
        /**
        * @return Returns the memo_no.
        */
        public String getMemo_no() {
                return memo_no;
        }
        /**
        * @param memo_no The memo_no to set.
        */
        public void setMemo_no(String memo_no) {
                this.memo_no = memo_no;
        }
        /**
        * @return Returns the write_date.
        */
        public String getWrite_date() {
                return write_date;
        }
        /**
        * @param write_date The write_date to set.
        */
        public void setWrite_date(String write_date) {
                this.write_date = write_date;
        }
}


/////////////////////// SearchForm.java //////////////////////////
package board.model;

import org.apache.struts.action.ActionForm;

public class SearchForm extends ActionForm
{
        private String board_code = null;
        private String search_type = null;
        private String search_keyword = null;
       
        /**
        * @return Returns the board_code.
        */
        public String getBoard_code() {
                return board_code;
        }
        /**
        * @param board_code The board_code to set.
        */
        public void setBoard_code(String board_code) {
                this.board_code = board_code;
        }
        /**
        * @return Returns the search_keyword.
        */
        public String getSearch_keyword() {
                return search_keyword;
        }
        /**
        * @param search_keyword The search_keyword to set.
        */
        public void setSearch_keyword(String search_keyword) {
                this.search_keyword = search_keyword;
        }
        /**
        * @return Returns the search_type.
        */
        public String getSearch_type() {
                return search_type;
        }
        /**
        * @param search_type The search_type to set.
        */
        public void setSearch_type(String search_type) {
                this.search_type = search_type;
        }
}

////////////// memo_update_form.jsp ////////////////////////

<%
        /*
        *                개요                :  글 내용 보기
        *                작성일            :        2005-08-13
        *                작성자        :        김길재
        *                수정자        :
        *                파일명        :        /board/board_view.jsp
        *                버전                :        1.0
        *                이력          :        2005-08-13 : 초기 작성
        */
%>

<%@ page contentType="text/html;charset=euc-kr" %>
<%@ page import="board.model.MemoDAO,board.model.MemoVO" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<%
        String board_code = request.getParameter( "board_code" );
        String board_no = request.getParameter( "board_no" );
        String board_grade = request.getParameter( "board_grade" );
        String write_date = request.getParameter( "write_date" );
        String memo_no = request.getParameter( "memo_no" );
       
        MemoDAO MemoDAO = new MemoDAO();
       
        MemoVO Memo = MemoDAO.view( board_code , board_no , board_grade , write_date , memo_no );

%>

<script>

  /*
        *                개요                :  폼 오류 체크
        *                작성일            :        2005-08-08       
        *                작성자        :        김길재
        */
        function form_check()
        {
            if( MemoForm.memo.value.length > 200 )
            {
                    alert( "최대 200글자 입니다." );
                    return false;
            }
                else if( MemoForm.memo.value.length == 0 )
            {
                    alert( "꼬릿말을 입력해 주세요." );
                    return false;
            }
        }
       
</script>

<link href= "/multiboard/css/multi_board.css" rel="stylesheet" type="text/css">
<html>
<head>
  <title>멀티 게시판</title>
</head>
<body>
  <html:form action="/board/memo_form" method="post" enctype="multipart/form-data" onsubmit="javascript:return form_check()">
    <html:hidden property="action" value="update"/>
    <html:hidden property="board_code" value="<%=board_code%>"/>
    <html:hidden property="board_no" value="<%=board_no%>"/>
    <html:hidden property="board_grade" value="<%=board_grade%>"/>
    <html:hidden property="write_date" value="<%=write_date%>"/>
    <html:hidden property="memo_no" value="<%=memo_no%>"/>
    <table width="600" align="center">
      <tr>
        <td align="center" colspan="2">
                    꼬릿말 수정
        </td>
      </tr>
      <tr>
        <td width="500">
          <html:textarea property="memo" rows="2" cols="85" value="<%=Memo.getMemo()%>"></html:textarea>
        </td>
        <td width="100">
          <html:image src="/multiboard/images/board/memo_update2.gif" style="border:none"/>
        </td>
      </tr>
      <tr>
        <td>
                    최대 200글자입니다.( 엔터:2글자 )
        </td>
      </tr>
    </table>
  </html:form>
</body>
</html>   
       
///////////// process_fail.jsp //////////////////////////

<%
        /*
    *                개요                :  관리자 프로세스  성공 처리
        *                작성일            :        2005-08-08       
        *                작성자        :        김길재
        *                수정자        :
        *                파일명        :        /manager/process_success.jsp
        *                버전                :        1.0
        *                이력          :        2005-08-08 : 초기 작성
        */
%>
<%@ page contentType="text/html;charset=euc-kr" %>

<%

        String action = null;
        String board_code = null;
        String board_no = null;
        String board_grade = null;
        String write_date = null;
        String current_page = null;
       
        if( request.getParameter( "action" ) != null )
                action = request.getParameter( "action" );
        else
                action = ( String )request.getAttribute( "action" );
               
        if( request.getParameter( "board_code" ) != null )
                board_code = request.getParameter( "board_code" );
        else
                board_code = ( String )request.getAttribute( "board_code" );
               
        if( request.getParameter( "board_no" ) != null )
                board_no = request.getParameter( "board_no" );
        else
                board_no = ( String )request.getAttribute( "board_no" );
               
        if( request.getParameter( "board_grade" ) != null )
                board_grade = request.getParameter( "board_grade" );
        else
                board_grade = ( String )request.getAttribute( "board_grade" );
               
        if( request.getParameter( "write_date" ) != null )
                write_date = request.getParameter( "write_date" );
        else
                write_date = ( String )request.getAttribute( "write_date" );
       
        if( request.getParameter( "action" ) != null )
                action = request.getParameter( "action" );
        else
                action = ( String )request.getAttribute( "action" );
               
        if( request.getParameter( "board_code" ) != null )
                board_code = request.getParameter( "board_code" );
        else
                board_code = ( String )request.getAttribute( "board_code" );
               
        if( request.getParameter( "board_no" ) != null )
                board_no = request.getParameter( "board_no" );
        else
                board_no = ( String )request.getAttribute( "board_no" );
               
        if( request.getParameter( "board_grade" ) != null )
                board_grade = request.getParameter( "board_grade" );
        else
                board_grade = ( String )request.getAttribute( "board_grade" );
               
        if( request.getParameter( "write_date" ) != null )
                write_date = request.getParameter( "write_date" );
        else
                write_date = ( String )request.getAttribute( "write_date" );
               
        if( request.getParameter( "current_page" ) != null )
                current_page = request.getParameter( "current_page" );
        else
                current_page = ( String )request.getAttribute( "current_page" );

        String message = null;
        String forward = null;

       
       
        if( action.equals( "list" ) )
        {
                message = "게시판 목록을 로딩하는 과정에서 오류가 생겼습니다. 로그를 참조하세요.";
                forward = "list";
        }
        else if( action.equals( "insert" ) || action.equals( "reply_insert" ) )
        {
                message = "입력과정에서 오류가 생겼습니다. 로그를 참조하세요.";
                forward = "insert";
               
        }
        else if( action.equals( "update" ) )
        {
                message = "수정과정에서 오류가 생겼습니다. 로그를 참조하세요.";
                forward = "update";
               
        }
        else if( action.equals( "delete" ) )
        {
                message = "삭제과정에서 오류가 생겼습니다. 로그를 참조하세요.";
                forward = "view";
        }
%>

<script>
        alert( "<%=message%>" );
<%
        if( action.equals( "list" ) || action.equals( "insert") )
        {
%>       
        location.href="/multiboard/board/board_<%=forward%>.jsp?board_code=<%=board_code%>¤t_page=<%=current_page%>";
       
<%
        }
        else
        {
%>
        location.href="/multiboard/board/board_<%=forward%>.jsp?board_code=<%=board_code%>&board_no=<%=board_no%>&board_grade=<%=board_grade%>&write_date=<%=write_date%>¤t_page=<%=current_page%>";
<%
        }
%>
</script>

////////////// process_success.jsp //////////////////
<%
        /*
    *                개요                :  게시판 프로세스  성공 처리
        *                작성일            :        2005-08-12       
        *                작성자        :        김길재
        *                수정자        :
        *                파일명        :        /board/process_success.jsp
        *                버전                :        1.0
        *                이력          :        2005-08-12 : 초기 작성
        */
%>
<%@ page contentType="text/html;charset=euc-kr" %>

<%
        String action = null;
        String board_code = null;
        String board_no = null;
        String board_grade = null;
        String write_date = null;
        String current_page = null;
        String is_search = null;
       
        if( request.getParameter( "action" ) != null )
                action = request.getParameter( "action" );
        else
                action = ( String )request.getAttribute( "action" );
               
        if( request.getParameter( "board_code" ) != null )
                board_code = request.getParameter( "board_code" );
        else
                board_code = ( String )request.getAttribute( "board_code" );
               
        if( request.getParameter( "board_no" ) != null )
                board_no = request.getParameter( "board_no" );
        else
                board_no = ( String )request.getAttribute( "board_no" );
               
        if( request.getParameter( "board_grade" ) != null )
                board_grade = request.getParameter( "board_grade" );
        else
                board_grade = ( String )request.getAttribute( "board_grade" );
               
        if( request.getParameter( "write_date" ) != null )
                write_date = request.getParameter( "write_date" );
        else
                write_date = ( String )request.getAttribute( "write_date" );
               
        if( request.getParameter( "current_page" ) != null )
                current_page = request.getParameter( "current_page" );
        else
                current_page = ( String )request.getAttribute( "current_page" );
               
        if( request.getParameter( "is_search" ) != null )
                is_search = request.getParameter( "is_search" );
        else
                is_search = ( String )request.getAttribute( "is_search" );
               
        String message = null;
        String forward = null;

       
        //입력
        if( action.equals( "insert" ) )
        {
                message = "입력 되었습니다";
                forward  = "/multiboard/board/board_link.do?";
                forward += "action=list&";
            forward += "board_code=" + board_code ;
            forward += "¤t_page=1";
        }
        //답글 입력
        if( action.equals( "reply_insert" ) )
        {
                message = "입력 되었습니다";
                forward  = "/multiboard/board/board_link.do?";
                forward += "action=list&";
            forward += "board_code=" + board_code ;
            forward += "¤t_page=" + current_page ;
        }
        //수정
        else if( action.equals( "update" ) )
        {
                message = "수정 되었습니다";
                forward  = "/multiboard/board/board_link.do?";
                forward += "action=list&";
                forward += "&board_code=" + board_code ;
                forward += "¤t_page=" + current_page ;
        }
        //삭제
        else if( action.equals( "delete" ) )
        {
                message = "삭제 되었습니다.";
                forward =  "/multiboard/board/board_link.do?";
                forward += "&action=list" ;
                forward += "&board_code=" + board_code ;
                forward += "¤t_page=" + current_page ;
        }
       
               

       
%>

<script>
    alert( "<%=message%>" );
    location.href="<%=forward%>";
</script> 






댓글 없음:

댓글 쓰기