/* 
    IntraPMS Project
    사원 관리를 한 후 모든 사원을 보여주는 서블릿

    
*/
import java.io.* ;
import javax.servlet.* ;
import javax.servlet.http.* ;

import java.util.*;

import java.sql.DriverManager ;
import java.sql.Connection ;
import java.sql.Statement ;
import java.sql.ResultSet ;
import java.sql.SQLException ;

import com.etri.groupware.*;
import com.etri.groupware.organization.*;

public class ShowAllOfficialServlet extends HttpServlet
{
	GroupwareControllerInterface gc = null ;
	OrganizationManagementControllerInterface  omc = null ;
	Properties myPro = null ;

	public void init ( ServletConfig config ) throws ServletException {
		super.init ( config ) ;
		System.out.println ( "ShowAllOfficialServlet init () Call..........." ) ;

		// 그룹웨어 컨트롤러를 생성한다.
		// 먼저 프라퍼티를 생성한다.
		myPro = new Properties ( ) ;
		// DB매니저 구현 클래스 이름 설정
		myPro.put ( "OrganizationDBManagerClassName" , "PandaSoftOrganizationDBManager" ) ;
		myPro.put ( "BBSDBManagerClassName" , "PandaSoftBBSDBManager" ) ;
		myPro.put ( "EDADBManagerClassName" , "PandaSoftEDADBManager" ) ;
		myPro.put ( "MailDBManagerClassName" , "PandaSoftMailDBManager" ) ;
		////////////////////////////////////////
		System.out.println ( "모든 사원을 보여주는 서블릿의 프라퍼티 설정을 무사히 마쳤습니다." ) ;
		
		try {
			gc = GroupwareController.init ( myPro ) ;
			/////////////////////////////////////////////////
			System.out.println ( "모든 사원을 보여주는 서블릿에서 사용하는 그룹웨어 컨트롤러 생성을 무사히 마쳤습니다." ) ;
			
			// 조직도 관리 컨트롤러를 가져온다.
			omc = gc.createOrganizationManagementController ( ) ;
			///////////////////////////////////////////////////////////
			System.out.println ( "모든 사원을 보여주는 서블릿에서 사용하는 조직도 관리 컨트롤러 생성도 무사히 마쳤습니다." ) ;
		} catch ( Exception e ) { }
	}
	
	public void destroy ( ) {
		super.destroy();
		DBConnectionManager.instance.release() ;
		System.out.println ( "ShowAllOfficialServlet destroy () Call..........." ) ;
	}

	/*----------------------------------------------------------------- */
	/**
	 [메소드이름]: doGet<br>
	 [기능]: 사원 관리를 한 후 모든 사원을 보여준다.<br>
	 [파라미터]: HttpServletRequest request, HttpServletResponse response<br>
	 [호출자] : 사용자<br>
	 */
	/*--------------------------------------------------------------- */			
	public void doGet (
		HttpServletRequest request ,
		HttpServletResponse response ) throws ServletException , IOException
	{
		PrintWriter out ;
		String head = " 팬더 소프트 " ;
		// Set content type and other response header fields first
		response.setContentType ( "text/html;charset=euc-kr" ) ;
		// then write the data of the response
		out = new PrintWriter ( new OutputStreamWriter ( response.getOutputStream ( ) , "EUC-KR" ) ) ;
		
		/////////////////////////////////////////////
		// 세션 확인 부분 - 인증되지 않은 사용자의 경우 Login.html 로 되돌려 보낸다.
		String authenKind = null ;
		String authenId = null ;
		String authenName = null ;
		String authenLoginStatus = null;
		
		HttpSession session = request.getSession ();
		authenLoginStatus =  (String)session.getValue("Authentication");
		
		if( (authenLoginStatus == null) || ( !(authenLoginStatus.equals("true")) ) ){
			session.invalidate();
			response.sendRedirect("../Login.html");
		} else {
			authenKind = (String)session.getValue("Kind");
			authenId = (String)session.getValue("Id");
			authenName = (String)session.getValue("Name");   
		}
		/////////////////////////////////////////////
		
		// 파라미터로 넘어온 페이지로, 현재 몇 페이지인지를 알 수 있다.
		String page = request.getParameter("page");		
		page = new String ( page.getBytes("ISO-8859-1") , "EUC-KR" ) ;
	
		// 데이타베이스에서 얻어올 모든 사원의 내용으로 Official클래스의 배열 형태이다.
		Official[] allOfficial = null ;
				
		// 넘겨받은 팀의 이름을 저장한다.
		String name = request.getParameter ( "name" ) ;
		// 폼 태그에서 넘어온 한글과 그냥 파라미터로 넘어온 한글 처리가 달라야 한다.
		if ( request.getParameter("form") != null ) {
			// 폼 태그로부터 넘어온 파라미터의 경우이다.
			name = new String ( name.getBytes("ISO-8859-1") , "EUC-KR" ) ;	
		} 
		String o1 = name ;
		
		// 넘겨받은 팀의 상위 부서를 저장한다.
		String upDep = request.getParameter ( "upDep" ) ;
		// 폼 태그에서 넘어온 한글과 그냥 파라미터로 넘어온 한글 처리가 달라야 한다.
		if ( request.getParameter("form") != null ) {
			// 폼 태그로부터 넘어온 파라미터의 경우이다.
			upDep = new String ( upDep.getBytes("ISO-8859-1") , "EUC-KR" ) ;			
		} 
		String o2 = upDep ;
		
		// 조직도 트리를 업 데이트 해야 하는지를 알 수 있는 플래그
		boolean isUpdateTree = false ;
		// 검색인지 아닌지를 알 수 있는 플래그
		boolean isSearch = false ;
		// 검색결과의 다른 페이지인지를 알 수 있는 플래그
		boolean isSearchResult = false ;
		// search파라미터가 null이 아니면 검색 플래그를 true로 설정한다.
		if ( request.getParameter("search") != null ) isSearch = true ;
		// 부서이름과 팀이름이 모두 search일 경우는 검색 결과의 다른 페이지인 경우이다.
		if ( name.equals("search") && upDep.equals("search") ) isSearchResult = true ;
		
		/////////
		// 검색 결과일 경우에는 아무것도 안 해도 된다.
		if ( isSearchResult ) {
			// 검색 결과 다른 페이지일 경우에는 검색 결과를 저장했는 클래스에세 꺼내 오기만 하면 된다.
			allOfficial = OfficialSearchResult.getSearchOffi() ;
			name = "search" ;
			upDep = "search" ;
			isSearch = true ;
		} else {
			////////
			
			if ( (!isSearchResult) && (request.getParameter("back")==null) && (request.getParameter("id")!=null) && (request.getParameter("DepChange")==null) ) {
			// 등록하기 버튼이 눌러졌을 경우에 새로운 팀을 등록하고 이 부서의 팀 리스트를 보여준다.
			// 등록 하기 버튼을 눌렀을 경우이다.
			
			// 폼 태그의 변수 값을 얻는다.
			String id = request.getParameter("id") ;		
			if ( request.getParameter("form") != null ) {
				id = new String ( id.getBytes("ISO-8859-1") , "EUC-KR" ) ;
			}
			// 앞으로 쓰일 변수들을 선언한다.
			String password = null ;
			String residentRegistrationNum = null ;			
			String firstName = null ;
			String familyName = null ;
			int sex = 0 ;
			int age = 0 ;
			String address = null ;
			String zipCode = null ;
			String phoneNumber = null ;
			String email = null ;
			String personalPhone = null ;
			String weightWork = null ;
			String department = null ;
			String team = null ;
			String orders = null ;
			int year = 0 ;
			int month = 0 ;
			int day = 0 ;
			String homePhoneNumber = null ;
			String faxNumber = null ;
			String others = null ;
			int userKind = 0 ;
			
			if ( request.getParameter("delete") != null ) {
				// 사원 삭제의 경우에는 파라미터로 id만 넘어오므로 다른 파라미터들은 받지 않는다.
			} else {
				if ( !isSearch ) {
					password = request.getParameter("password") ;
					password = new String ( password.getBytes("ISO-8859-1") , "EUC-KR" ) ;
					residentRegistrationNum = request.getParameter("residentRegistrationNum") ;
					residentRegistrationNum = new String ( residentRegistrationNum.getBytes("ISO-8859-1") , "EUC-KR" ) ;
				}
				firstName = request.getParameter("firstName") ;
				firstName = new String ( firstName.getBytes("ISO-8859-1") , "EUC-KR" ) ;
				if ( !isSearch ) {
					familyName = request.getParameter("familyName") ;
					familyName = new String ( familyName.getBytes("ISO-8859-1") , "EUC-KR" ) ;
				}
				sex = Integer.parseInt ( request.getParameter("sex") ) ;
				if ( !isSearch ) {
					age = Integer.parseInt ( request.getParameter("age") ) ;		
				}
				address = request.getParameter("address") ;
				address = new String ( address.getBytes("ISO-8859-1") , "EUC-KR" ) ;
				if ( !isSearch ) {
					zipCode = request.getParameter("zipCode") ;
					zipCode = new String ( zipCode.getBytes("ISO-8859-1") , "EUC-KR" ) ;
					phoneNumber = request.getParameter("phoneNumber") ;
					phoneNumber = new String ( phoneNumber.getBytes("ISO-8859-1") , "EUC-KR" ) ;
					email = request.getParameter("email") ;
					email = new String ( email.getBytes("ISO-8859-1") , "EUC-KR" ) ;
					personalPhone = request.getParameter("personalPhone") ;
					personalPhone = new String ( personalPhone.getBytes("ISO-8859-1") , "EUC-KR" ) ;
				}
				weightWork = request.getParameter("weightWork") ;		
				weightWork = new String ( weightWork.getBytes("ISO-8859-1") , "EUC-KR" ) ;
				if ( !isSearch ) {
					department = request.getParameter("department") ;
					department = new String ( department.getBytes("ISO-8859-1") , "EUC-KR" ) ;
					team = request.getParameter("team") ;
					team = new String ( team.getBytes("ISO-8859-1") , "EUC-KR" ) ;
				}
				orders = request.getParameter("orders") ;
				orders = new String ( orders.getBytes("ISO-8859-1") , "EUC-KR" ) ;
				year = Integer.parseInt ( request.getParameter("year") ) ;
				month = Integer.parseInt ( request.getParameter("month") ) ;
				day = Integer.parseInt ( request.getParameter("day") ) ;
				if ( !isSearch ) {
					homePhoneNumber = request.getParameter("homePhoneNumber") ;
					homePhoneNumber = new String ( homePhoneNumber.getBytes("ISO-8859-1") , "EUC-KR" ) ;
					faxNumber = request.getParameter("faxNumber") ;
					faxNumber = new String ( faxNumber.getBytes("ISO-8859-1") , "EUC-KR" ) ;
					if ( request.getParameter("userKind").equals("user") ) userKind = 0 ;
					else userKind = 1 ;					
				}
				others = request.getParameter("others") ;
				others = new String ( others.getBytes("ISO-8859-1") , "EUC-KR" ) ;
				///////////////////////
			}

			Official newOfficial = new Official ( ) ;
			
			if ( !isSearch ) {
				newOfficial.setId ( id ) ;
				if ( request.getParameter("delete") != null ) {
					// 사원 삭제의경우 id 만 set해 주면 된다.
				} else {
					newOfficial.setPassword ( password ) ;
					newOfficial.setResidentRegistrationNum ( residentRegistrationNum ) ;
					newOfficial.setFirstName ( firstName ) ;
					newOfficial.setFamilyName ( familyName ) ;
					if ( sex == 1 ) newOfficial.setSex ( true ) ;
					else newOfficial.setSex ( false ) ;
					newOfficial.setAge ( age ) ;
					newOfficial.setAddress ( address ) ;
					newOfficial.setZipCode ( zipCode ) ;
					newOfficial.setPhoneNumber ( phoneNumber ) ;
					newOfficial.setEmail ( email ) ;
					newOfficial.setPersonalPhone ( personalPhone ) ;
					newOfficial.setWeightWork ( weightWork ) ;
					newOfficial.setDepartment ( department ) ;
					newOfficial.setTeam ( team ) ;
					newOfficial.setOrders ( orders ) ;
					Calendar enterCompanyDay = Calendar.getInstance ( ) ;
					enterCompanyDay.set ( Calendar.YEAR , year ) ;
					enterCompanyDay.set ( Calendar.MONTH , month ) ;
					enterCompanyDay.set ( Calendar.DATE , day ) ;
					newOfficial.setEnterCompanyDay ( enterCompanyDay ) ;
					newOfficial.setHomePhoneNumber ( homePhoneNumber ) ;
					newOfficial.setFaxNumber ( faxNumber ) ;
					newOfficial.setOthers ( others ) ;
				}
			} else {
				// 검색 조건이 주어지고 검색 버튼이 눌러졌을 경우이다.
				OfficialSearchProperty newOSP = new OfficialSearchProperty ( ) ;

				newOSP.setName ( firstName ) ;
				newOSP.setWeightWork ( weightWork ) ;
				Calendar enterCompanyDay = Calendar.getInstance ( ) ;
				if ( request.getParameter ("ecd") != null ) {
					newOSP.setIsECD ( true ) ;
					enterCompanyDay.set ( Calendar.YEAR , year ) ;
					enterCompanyDay.set ( Calendar.MONTH , month ) ;
					enterCompanyDay.set ( Calendar.DATE , day ) ;
					if ( request.getParameter ( "boa" ).equals ( "b" ) ) {
						newOSP.setBeforeOrAfter ( true ) ;
					} else {
						newOSP.setBeforeOrAfter ( false ) ;
					}
				} else {
					newOSP.setIsECD ( false ) ;
				}					
				newOSP.setAddress ( address ) ;
				if ( request.getParameter ( "sexok" ) != null ) {
					newOSP.setIsSEX ( true ) ;
					if ( sex == 1 ) newOSP.setSex ( true ) ;
					else newOSP.setSex ( false ) ;
				} else {
					newOSP.setIsSEX ( false ) ;
				}
				newOSP.setEnterCompanyDay ( enterCompanyDay ) ;
				newOSP.setOrders ( orders ) ;
				newOSP.setOthers ( others ) ;
				newOSP.setId ( id ) ;				
				if ( request.getParameter ( "orAnd" ).equals ( "or" ) ) {
					newOSP.setOrOrAnd ( true ) ;
				} else {
					newOSP.setOrOrAnd ( false ) ;
				}
				allOfficial = omc.searchOfficial ( newOSP ) ;		
				// 검색 결과를 저장하자...
				OfficialSearchResult.setSearchOffi ( allOfficial ) ;
				name = "search" ;
				upDep = "search" ;		
			}
			////////////////
			if ( request.getParameter ( "delete" ) != null ) {
				// 삭제하기 버튼을 눌렀을 경우....
				omc.deleteOfficial ( newOfficial ) ;
				// 데이타 베이스에서 삭제했습니다.		
			} else if ( request.getParameter ( "update" ) != null ) {
				// 변경하기 버튼을 눌렀을 경우....
				OrganizationResultStatus ors = omc.updateOfficial ( newOfficial ) ;
				if ( ors.getResultStatus() == 1 ) {
					// 변경하는것에 실패했을 경우
					out.println ( "<html><head><title>에러</title></head>" ) ;
					out.println ( "<body><p align=\"center\">에러가 발생했습니다.</p>" ) ;
					out.println ( "<p align=\"center\">" + ors.getReason() + "</p>" ) ;
					out.println ( "<form action=\"/servlet/AddSearchOfficialServlet\">" ) ;
					out.println ( "<input type=\"hidden\" name=\"upDep\" value=\"" + newOfficial.getDepartment() + "\">" ) ;
					out.println ( "<input type=\"hidden\" name=\"team\" value=\"" + newOfficial.getTeam() + "\">" ) ;
					out.println ( "<p align=\"center\"><input type=\"submit\" name=\"update\" value=\"되돌아 가기\"></p></form>" ) ;
					out.println ( "</body></html>" ) ;
					out.close ( ) ;
				}
			
				// 데이타 베이스에 업 데이트했습니다.		
			} else {
				if ( request.getParameter("search") == null ) {
					// 등록하기 버튼을 눌렀을 경우...
					OrganizationResultStatus ors = omc.addOfficial ( newOfficial ) ;
					if ( ors.getResultStatus() == 1 ) {
						// 입력하는것에 실패했을 경우
						out.println ( "<html><head><title>에러</title></head>" ) ;
						out.println ( "<body><p align=\"center\">에러가 발생했습니다.</p>" ) ;
						out.println ( "<p align=\"center\">이미 존재하는 사원 아이디입니다.</p>" ) ;
						out.println ( "<p align=\"center\">" + ors.getReason() + "</p>" ) ;
						//out.println ( "<form action=\"/servlet/AddSearchOfficialServlet\">" ) ;
						//out.println ( "<input type=\"hidden\" name=\"upDep\" value=\"" + newOfficial.getDepartment() + "\">" ) ;
						//out.println ( "<input type=\"hidden\" name=\"team\" value=\"" + newOfficial.getTeam() + "\">" ) ;
						out.println ( "<p align=\"center\"><input type=\"button\" name=\"add\" value=\"되돌아 가기\" onClick=\"history.back();\"></p>" ) ;
						out.println ( "</body></html>" ) ;
						out.close ( ) ;
					}
				}
			}		
			if ( (request.getParameter("delete")==null) && (!isSearch) ) {
				name = team ;
				upDep = department ;
			}
		} else if ( request.getParameter("DepChange")!=null ) {
			String id = request.getParameter("id") ;
			String orders = request.getParameter ("orders" ) ;
			omc.changeDepartment ( id , upDep , name , orders ) ;
			isUpdateTree = true ;
		}

		if ( request.getParameter("search") == null ) {
			// 이름이 넘겨받은 팀인 팀 객체를 하나 생성한다.
			Team team = new Team ( ) ;
			team.setName ( name ) ;
			team.setUpDepartment ( upDep ) ;
			
			// 데이타 베이스에서 파라미터로 넘겨주는 팀의 모든 사원의 내용을 가져온다.
			allOfficial = omc.getAllOfficial ( team ) ;
		} else {
			// 검색 결과의 사원들을 출력할 경우이다.
			// 검색 결과의 사원들은 이미 allOfficial에 저장되어 있으므로 다시 가져오면 안된다.			
		}
		
		if ( !isSearch ) {
			if ( upDep.equals ( "null" ) && name.equals ( "null" ) ) response.sendRedirect("/servlet/ShowAllDepartmentServlet?page=1&up=true" );
			if ( !(upDep.equals ( "null" )) && name.equals ( "null" ) ) response.sendRedirect("/servlet/ShowAllDepartmentServlet?page=1&up=true" ) ;
		}
		
		/////////
		}
		/////////
		
		if ( !isSearch ) {
			out.println ( "<html><head><title>팬더 소프트" + upDep + name + "</title>" ) ;
		} else {
			out.println ( "<html><head><title>팬더 소프트 사원 검색 결과</title>" ) ;
		}
		out.println ( "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=euc-kr\">" ) ;
		out.println ( "<style type=\"text/css\">" ) ;
		out.println ( "BODY {font-size:9pt; color:\"#000000\"; line-height:14px;}" ) ;
		out.println ( "A:Link {font-size:9pt; color:\"#000033\"; line-height:14px; text-decoration:none}" ) ;
		out.println ( "A:Visited {font-size:9pt; color:\"#330033\"; line-height:14px; text-decoration:none}" ) ;
		out.println ( "A:Hover {font-size:9pt; color:\"#0000ff\"; line-height:14px; text-decoration:underline}" ) ;
		out.println ( "td {font-size:9pt;}" ) ;
		out.println ( "td.red {font-size:9pt; color:\"#ff0000\"}" ) ;
		out.println ( "td.black {font-size:9pt; color:\"#000000\"}" ) ;
		out.println ( "td.navy {font-size:9pt; color:\"#000066\"}" ) ;
		out.println ( "td.space {font-size:1pt;}" ) ;
		out.println ( "</style>  </HEAD>" ) ;

		if ( isUpdateTree ) {
			out.println ( "<body onLoad=\"updateOrgTree()\">" ) ;
		} else {
			out.println ( "<body>" ) ;
		}
		out.println ( "<p align=right><img src=\"/image/우측_관리기능.gif\" alt=\"관리 기능\"></p>" ) ;
		
		out.println ( "<script language=\"JavaScript\">" ) ;
		out.println ( "<!--" ) ;
		out.println ( "	function updateOrgTree()" ) ;
		out.println ( "	{ " ) ;
		out.println ( "		parent.frames[\'contents\'].location=\"/servlet/ShowOrganizationTreeServlet\"; " ) ;
		out.println ( "	} " ) ;
		out.println ( "//-->" ) ;
		out.println ( "</script>" ) ;

		out.println ( "<table border=0 hspace=1 width=\"100%\" cellpadding=3><tr><td>" ) ;		

		out.println ( "<form><table border=0 hspace=4 width=800 cellpadding=3><tr width=800><td width=340>" ) ;	
		if ( isSearch ) {
			//out.println ( "<a href=\"/servlet/MainServlet\" target=\"_parent\">그룹웨어</a>    >>    <a href=\"/servlet/ShowOrganizationTreeServlet\" target=\"contents\" onClick=\"parent.frames[\'detail\'].location=\'/orgdetail.html\'\">조직관리</a>    >>    <a href=\"/servlet/ShowAllDepartmentServlet?page=1\">팬더소프트</a></font>" ) ;
			out.println ( "<a href=\"/servlet/ShowOrganizationTreeServlet\" target=\"contents\" onClick=\"parent.frames[\'detail\'].location=\'/orgdetail.html\'\">조직관리</a></font>" ) ;
			out.println ( "</td><td width=460 align=right>" ) ;
			out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchDepartmentServlet?add=add\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].depAdd.src='/image/부서등록-1.jpg'\" onMouseOut=\"document.forms[0].depAdd.src='/image/부서등록.jpg'\"><img name=depAdd src=\"/image/부서등록.jpg\"></a>" ) ;
			out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchDepartmentServlet?search=search\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].depSea.src='/image/부서검색-1.jpg'\" onMouseOut=\"document.forms[0].depSea.src='/image/부서검색.jpg'\"><img name=depSea src=\"/image/부서검색.jpg\"></a>" ) ;
			out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchTeamServlet?add=add&upDep=upDep\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].temAdd.src='/image/팀등록-1.jpg'\" onMouseOut=\"document.forms[0].temAdd.src='/image/팀등록.jpg'\"><img name=temAdd src=\"/image/팀등록.jpg\"></a>" ) ;
			out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchTeamServlet?search=search&upDep=upDep\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].temSea.src='/image/팀검색-1.jpg'\" onMouseOut=\"document.forms[0].temSea.src='/image/팀검색.jpg'\"><img name=temSea src=\"/image/팀검색.jpg\"></a>" ) ;
			out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchOfficialServlet?add=add&upDep=null&team=null\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].offAdd.src='/image/사원등록-1.jpg'\" onMouseOut=\"document.forms[0].offAdd.src='/image/사원등록.jpg'\"><img name=offAdd src=\"/image/사원등록.jpg\"></a>" ) ;
			out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchOfficialServlet?search=search&upDep=null&team=null\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].offSea.src='/image/사원검색-1.jpg'\" onMouseOut=\"document.forms[0].offSea.src='/image/사원검색.jpg'\"><img name=offSea src=\"/image/사원검색.jpg\"></a>" ) ;
			out.println ( "</td></tr><tr width=800 valign=middle bgcolor=\"#3399ff\"><td colspan=2 width=800><nobr><FONT color=#ffffff>사원 검색 결과</nobr></td></tr></table>" ) ;
		} else {
			//out.println ( "<a href=\"/servlet/MainServlet\" target=\"_parent\">그룹웨어</a>    >>    <a href=\"/servlet/ShowOrganizationTreeServlet\" target=\"contents\" onClick=\"parent.frames[\'detail\'].location=\'/orgdetail.html\'\">조직관리</a></font>" ) ;
			out.println ( "<a href=\"/servlet/ShowOrganizationTreeServlet\" target=\"contents\" onClick=\"parent.frames[\'detail\'].location=\'/orgdetail.html\'\">조직관리</a>    >>    <a href=\"/servlet/ShowAllTeamServlet?page=1&name=" + upDep + "\">" + upDep + "</a></font>" ) ;
			out.println ( "</td><td width=460 align=right>" ) ;
			out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchDepartmentServlet?add=add\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].depAdd.src='/image/부서등록-1.jpg'\" onMouseOut=\"document.forms[0].depAdd.src='/image/부서등록.jpg'\"><img name=depAdd src=\"/image/부서등록.jpg\"></a>" ) ;
			out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchDepartmentServlet?search=search\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].depSea.src='/image/부서검색-1.jpg'\" onMouseOut=\"document.forms[0].depSea.src='/image/부서검색.jpg'\"><img name=depSea src=\"/image/부서검색.jpg\"></a>" ) ;
			out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchTeamServlet?add=add&upDep=upDep\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].temAdd.src='/image/팀등록-1.jpg'\" onMouseOut=\"document.forms[0].temAdd.src='/image/팀등록.jpg'\"><img name=temAdd src=\"/image/팀등록.jpg\"></a>" ) ;
			out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchTeamServlet?search=search&upDep=upDep\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].temSea.src='/image/팀검색-1.jpg'\" onMouseOut=\"document.forms[0].temSea.src='/image/팀검색.jpg'\"><img name=temSea src=\"/image/팀검색.jpg\"></a>" ) ;
			out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchOfficialServlet?add=add&upDep=null&team=null\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].offAdd.src='/image/사원등록-1.jpg'\" onMouseOut=\"document.forms[0].offAdd.src='/image/사원등록.jpg'\"><img name=offAdd src=\"/image/사원등록.jpg\"></a>" ) ;
			out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchOfficialServlet?search=search&upDep=null&team=null\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].offSea.src='/image/사원검색-1.jpg'\" onMouseOut=\"document.forms[0].offSea.src='/image/사원검색.jpg'\"><img name=offSea src=\"/image/사원검색.jpg\"></a>" ) ;
			out.println ( "</td></tr><tr width=800 valign=middle bgcolor=\"#3399ff\"><td colspan=2 width=800><nobr><FONT color=#ffffff>" + name + "의 모든 사원 보기" + "</nobr></td></tr></table></form>" ) ;
		}		
		
		out.println ( "<p><p><!--------바뀌는  테이블------------>" ) ;
		out.println ( "<!--td align=\"center\" valign=\"top\"--> " ) ;
		out.println ( "<p><p><center><table width=\"731\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> " ) ;
		out.println ( "  <tr> " ) ;
		out.println ( "    <td width=\"10\">&nbsp;</td>" ) ;
		out.println ( "    <td width=\"10\">&nbsp;</td>"  ) ;
		out.println ( "    <td width=\"711\">&nbsp;</td>" ) ;
		out.println ( "  </tr>  <tr> " ) ;
		out.println ( "    <td width=\"10\">&nbsp;</td>" ) ;
		out.println ( "    <td width=\"10\">&nbsp;</td>" ) ;
		out.println ( "    <td width=\"711\">&nbsp;</td>" ) ;
		out.println ( "  </tr>  <tr> " ) ;
		out.println ( "    <td width=\"10\">&nbsp;</td>" ) ;
		out.println ( "    <td width=\"10\">&nbsp;</td>" ) ;
		out.println ( "    <td width=\"711\">&nbsp;</td>" ) ;
		out.println ( "  </tr></table>" ) ;
		out.println ( "<table width=\"710\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">" ) ;
		out.println ( "	<tr>	<td>&nbsp;&nbsp;&nbsp;</td>	<td>" ) ;
		out.println ( "<table border=0 cellpadding=2 cellspacing=0 bgcolor=#3399ff>" ) ;
		out.println ( "<tr><td width=600>" ) ;
		out.println ( "<table width=\"710\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">" ) ;
		out.println ( "	<tr>	<td width=130 align=center bgcolor=#3399ff>사원 ID</td>" ) ;
		out.println ( "	<td width=130 align=center bgcolor=#3399ff>사원 이름</td>" ) ;
		out.println ( "	<td width=190 align=center bgcolor=#3399ff>사원 주민등록번호</td>" ) ;
		out.println ( "	<td width=130 align=center bgcolor=#3399ff>사원 직급</td>" ) ;
		out.println ( "	<td width=130 align=center bgcolor=#3399ff>사원 성별</td>" ) ;
		out.println ( "	</tr>" ) ;
		
		////////////////////////////////////////////////////
		// 페이지를 위해 부서의 갯수를 알아내자....
		int dbNumber = 0 ;
		for ( dbNumber = 0 ; !(allOfficial[dbNumber].getId().equals("null")) ; dbNumber++ ) { }
		// 지금부터는 [dbNumber] 가 총 부서의 갯수이다.
		////////////////////////////////////////////////////
		// 이제 총 페이지의 갯수를 알아내자..
		int pageNumber = dbNumber/4 ;
		if ( dbNumber%4 != 0 ) pageNumber++ ;
		// 파라미터로 현재 페이지를 얻어낼수 있다.
		//String page = request.getParameter ( "page" ) ;
		// 파라미터로 넘어온 현재 페이지는 curPage이다.
		int curPage = Integer.parseInt ( page ) ;
		// 현재 페이지의 수에 맞추어서 튜플을 건너 뛰어야한다.
		int loop = ((curPage-1)*4) ;
		/////////////////////////////////////////////////
		// 라스트 페이지를 구해보자.
		int last = 0 ;
		if ( (pageNumber%3)==1 ) last = pageNumber ;
		else if ( (pageNumber%3)==2 ) last = pageNumber-1 ;
		else if ( (pageNumber%3)==0 ) last = pageNumber-2 ;
		String lastPage = new String ( Integer.toString ( last ) ) ;
		// Pre 페이지를 구해보자.
		int pre = 0 ;
		if ( (curPage%3)==1 ) pre = curPage-3 ;
		else if ( (curPage%3)==2 ) pre = curPage-4 ;
		else if ( (curPage%3)==0 ) pre = curPage-5 ;
		String prePage = new String ( Integer.toString ( pre ) ) ;
		// Next 페이지를 구해보자.
		int next = 0 ;
		if ( (curPage%3)==1 ) next = curPage+3 ;
		else if ( (curPage%3)==2 ) next = curPage+2 ;
		else if ( (curPage%3)==0 ) next = curPage+1 ;
		String nextPage = new String ( Integer.toString ( next ) ) ;
		// curPage에 대한 것들을 String으로 바꾸자.
		// curPage ( int ) 이고 page ( String ) 입니다.
		String mmPage = new String ( Integer.toString ( curPage-2 ) ) ;
		String mPage = new String ( Integer.toString ( curPage-1 ) ) ;
		String pPage = new String ( Integer.toString ( curPage+1 ) ) ;
		String ppPage = new String ( Integer.toString ( curPage+2 ) ) ;
		/////////////////////////////////////////////////////////////////
		boolean stop = false ;						
			
		out.println ( "    <tr>" ) ;
		if ( allOfficial[loop].getId().equals("null") ) {
			stop = true ;
			out.println ( "<TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD>" ) ;
		} else {
				out.println ( "<TD bgcolor=\'#f7f7f7\'><a href=\"" 
														+ "/servlet/ShowOneOfficialServlet?id=" + allOfficial[loop].getId() 
														+ "&department=" + allOfficial[loop].getDepartment() 
														+ "&team=" + allOfficial[loop].getTeam() 
														+ "\" target=\"detail\">" + allOfficial[loop].getId() + "</A></TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getFamilyName() + " " + allOfficial[loop].getFirstName() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getResidentRegistrationNum() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getOrders() + "</TD>" ) ;
				String sex = new String ( ) ;
				if ( allOfficial[loop].getSex() ) sex = "남자" ;
				else sex = "여자" ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + sex + "</TD>" ) ;
				loop++ ;
		}
			out.println ( "    </tr>" ) ;
			out.println ( "    <tr>" ) ;

			if ( allOfficial[loop].getId().equals("null") ) {
				stop = true ;
				out.println ( "<TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD>" ) ;
			} else {
				out.println ( "<TD bgcolor=\'#f7f7f7\'><a href=\"" 
														+ "/servlet/ShowOneOfficialServlet?id=" + allOfficial[loop].getId() 
														+ "&department=" + allOfficial[loop].getDepartment() 
														+ "&team=" + allOfficial[loop].getTeam() 
														+ "\" target=\"detail\">" + allOfficial[loop].getId() + "</A></TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getFamilyName() + " " + allOfficial[loop].getFirstName() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getResidentRegistrationNum() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getOrders() + "</TD>" ) ;
				String sex = new String ( ) ;
				if ( allOfficial[loop].getSex() ) sex = "남자" ;
				else sex = "여자" ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + sex + "</TD>" ) ;

				loop++ ;
			}
			out.println ( "    </tr>" ) ;
			out.println ( "    <tr>" ) ;
			if ( (allOfficial[loop].getId().equals("null")) || (stop==true) ) {
				stop = true ;
				out.println ( "<TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD>" ) ;
			} else {
				out.println ( "<TD bgcolor=\'#f7f7f7\'><a href=\"" 
														+ "/servlet/ShowOneOfficialServlet?id=" + allOfficial[loop].getId() 
														+ "&department=" + allOfficial[loop].getDepartment() 
														+ "&team=" + allOfficial[loop].getTeam() 
														+ "\" target=\"detail\">" + allOfficial[loop].getId() + "</A></TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getFamilyName() + " " + allOfficial[loop].getFirstName() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getResidentRegistrationNum() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getOrders() + "</TD>" ) ;
				String sex = new String ( ) ;
				if ( allOfficial[loop].getSex() ) sex = "남자" ;
				else sex = "여자" ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + sex + "</TD>" ) ;

				loop++ ;
			}
			out.println ( "    </tr>" ) ;
			out.println ( "    <tr>" ) ;
			if ( (allOfficial[loop].getId().equals("null")) || (stop==true) ) {
				out.println ( "<TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD>" ) ;
			} else {
				out.println ( "<TD bgcolor=\'#f7f7f7\'><a href=\"" 
														+ "/servlet/ShowOneOfficialServlet?id=" + allOfficial[loop].getId() 
														+ "&department=" + allOfficial[loop].getDepartment() 
														+ "&team=" + allOfficial[loop].getTeam() 
														+ "\" target=\"detail\">" + allOfficial[loop].getId() + "</A></TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getFamilyName() + " " + allOfficial[loop].getFirstName() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getResidentRegistrationNum() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getOrders() + "</TD>" ) ;
				String sex = new String ( ) ;
				if ( allOfficial[loop].getSex() ) sex = "남자" ;
				else sex = "여자" ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + sex + "</TD>" ) ;
			}
			out.println ( "    </tr>" ) ;		
			out.println ( "</table>" ) ;
			out.println ( "			<!----------------------------------글 리스트보여주는 테이블의 끝-------------------------->" ) ;
			out.println ( "</td></tr></table>" ) ;
			out.println ( "<!----------------------------------글 리스트 보여주는 테이블을 약간 오른쪽으로 하기위한 큰 테이블의 끝 ------->" ) ;
			out.println ( "</td></tr></table></center><br>" ) ;
			
			out.println ( "<table align=center><tr align=center>" ) ;			

		// 페이지의 숫자를 이용하여 몇번째 tuple부터 가져올지를 알 수 있다.
		// 그래서 4개의 데이타를 모두 써주 었다.
		// 이제 마지막 줄은 여러가지 형태로 나올 수 있다.
		if ( pageNumber == 0 ) {
			// 데이타 베이스에 데이타가 하나도 없는 경우이다.
			//out.println ( "<p align=\"center\">이 팀에는 사원이 존재하지 않습니다.</p> " ) ;
			//out.println ( "<p align=\"center\">새로운 사원을 등록하여 주십시요.</p> " ) ;
		} else	if ( curPage == 1 ) {
			if ( pageNumber == 1 ) {
				// 총 페이지가 1개인 경우이다. 이때는 [1] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[1]</font></TD> " ) ;
			} else if ( pageNumber == 2 ) {
				// 총 페이지가 2개인 경우이다. 이때는 [1][2] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[1]</font></TD> " ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=2\">[2]</a></TD> " ) ;
			} else if ( pageNumber == 3 ) {
				// 총 페이지가 3개인 경우이다. 이때는 [1][2][3] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[1]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=2\">[2]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=3\">[3]</a></TD> " ) ;
			} else if ( pageNumber > 3 ) {
				// 총 페이지가 4개 이상인 경우이다. 이때는 [1][2][3] [next] [last] 의 형태이다. 
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[1]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=2\">[2]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=3\">[3]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=4\">[Next]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + lastPage + "\">[Last]</a></TD>" ) ;
			}
		} else if ( curPage == 2 ) {
			if ( pageNumber == 1 ) {
				// 잘못된 파라미터이다.
				out.println ( "<TD align=middle vAlign=center height=21>잘못된 파라미터 입니다.</TD> " ) ;
			} else if ( pageNumber == 2 ) {
				// 총 페이지가 2개인 경우 이다. 이때는 [1][2] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[1]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[2]</font></TD> " ) ;
			} else if ( pageNumber == 3 ) {
				// 총 페이지가 3개인 경우이다. 이때는 [1][2][3] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[1]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[2]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=3\">[3]</a></TD> " ) ;
			} else if ( pageNumber > 3 ) {
				// 총 페이지가 4개 이상인 경우이다. 이때는 [1][2][3] [next] [last] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[1]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[2]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=3\">[3]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=4\">[Next]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + lastPage + "\">[Last]</a></TD>" ) ;
			}						
		} else if ( curPage == 3 ) {
			if ( pageNumber == 1 ) {
				// 잘못된 파라미터이다.
				out.println ( "<TD align=middle vAlign=center height=21>잘못된 파라미터 입니다.</TD> " ) ;
			} else if ( pageNumber == 2 ) {
				// 잘못된 파라미터이다.
				out.println ( "<TD align=middle vAlign=center height=21>잘못된 파라미터 입니다.</TD> " ) ;
			} else if ( pageNumber == 3 ) {
				// 총 페이지가 3개인 경우이다. 이때는 [1][2][3] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[1]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=2\">[2]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[3]</font></TD> " ) ;
			} else if ( pageNumber > 3 ) {
				// 총 페이지가 4개 이상인 경우이다. 이때는 [1][2][3] [next] [last] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[1]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=2\">[2]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[3]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=4\">[Next]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + lastPage + "\">[Last]</a></TD>" ) ;
			}					
		} else if ( (((curPage%3)==1)&&((curPage+2)<pageNumber)) || (((curPage%3)==2)&&((curPage+1)<pageNumber)) || (((curPage%3)==0)&&(curPage<pageNumber)) ) {
			// 현재 파라미터로 넘어온 페이지가 [first][pre][x][x][x][next][last]  의 형태일 경우..
			if ( (curPage%3)==1 ) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + pPage + "\">[" + pPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + ppPage + "\">[" + ppPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + nextPage + "\">[Next]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + lastPage + "\">[Last]</a></TD>" ) ;
			} else if ( (curPage%3)==2) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mPage + "\">[" + mPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + pPage + "\">[" + pPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + nextPage + "\">[Next]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + lastPage + "\">[Last]</a></TD>" ) ;
			} else if ( (curPage%3)==0) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mmPage + "\">[" + mmPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mPage + "\">[" + mPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + nextPage + "\">[Next]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + lastPage + "\">[Last]</a></TD>" ) ;
			}
		} else if ( (pageNumber%3)==1 ) {
			// 현재 파라미터로 넘어온 페이지가 [first][pre][x] 의 형태일 경우...
			out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
			out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
			out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
		} else if ( (pageNumber%3)==2 ) {
			// 현재 파라미터로 넘어온 페이지가 [first][pre][x][x] 의 형태일 경우...
			if ( (curPage%3)==1 ) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + pPage + "\">[" + pPage + "]</a></TD>" ) ;
			} else if ( (curPage%3)==2 ) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mPage + "\">[" + mPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
			}
		} else if ( (pageNumber%3)==0 ) {
			// 현재 파라미터로 넘어온 페이지가 [first][pre][x][x][x] 의 형태일 경우...
			if ( (curPage%3)==1 ) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + pPage + "\">[" + pPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + ppPage + "\">[" + ppPage + "]</a></TD>" ) ;
			} else if ( (curPage%3)==2 ) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mPage + "\">[" + mPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + pPage + "\">[" + pPage + "]</a></TD>" ) ;
			} else if ( (curPage%3)==0 ) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mmPage + "\">[" + mmPage + "]</a></TD>"  ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mPage + "\">[" + mPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
			}
		}
		out.println ( "</tr></table><br>" ) ;

		out.println ( "<br>" ) ;
		out.println ( "<CENTER><TABLE width=700 border=0 cellPadding=2 cellSpacing=1>" ) ;
		out.println ( "  <TR><TD align=right>" ) ;
		if ( isSearch ) {
			out.println ( "<form action=\"/servlet/ShowAllOfficialServlet\" method=\"GET\">" ) ;
			out.println ( "<input type=\"hidden\" name=\"form\" value=\"form\">" ) ;
			out.println ( "<input type=\"hidden\" name=\"page\" value=\"1\">" ) ;
			out.println ( "<input type=\"hidden\" name=\"name\" value=\"" + o1 + "\">" ) ;
			out.println ( "<input type=\"hidden\" name=\"upDep\" value=\"" + o2 + "\">" ) ;
			out.println ( "<INPUT type=submit name=back value=\"되돌아 가기\"></form>" ) ;
		} else {
			out.println ( "<form action=\"/servlet/ShowOneTeamServlet?\" method=\"GET\">" ) ;
			out.println ( "<input type=\"hidden\" name=\"property\" value=\"" + name + "\">" ) ;
			out.println ( "<input type=\"hidden\" name=\"upDep\" value=\"" + upDep + "\">" ) ;
			out.println ( "<INPUT type=submit name=detail value=\"" + name + " 상세 정보\">&nbsp;&nbsp;&nbsp;&nbsp;</form>" ) ;
			//out.println ( "</TD><TD width=\"190\">" ) ;
			//out.println ( "<form action=\"/servlet/AddSearchOfficialServlet\" method=\"GET\">" ) ;
			//out.println ( "<input type=\"hidden\" name=\"upDep\" value=\"" + upDep + "\">" ) ;
			//out.println ( "<input type=\"hidden\" name=\"team\" value=\"" + name + "\">" ) ;
			//out.println ( "<INPUT style=\"BACKGROUND-COLOR: #e3e3e3; BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; HEIGHT: 20px\" type=submit name=add value=\"사원 등록\">&nbsp;&nbsp;&nbsp;&nbsp;" ) ;
			//out.println ( "<INPUT style=\"BACKGROUND-COLOR: #e3e3e3; BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; HEIGHT: 20px\" type=submit name=search value=\"사원 검색\"></form>" ) ;
		}	
		out.println ( "</TD></TR></TABLE><CENTER>" ) ;
		out.println ( "</body></html>" ) ;
		
				
		out.close ( ) ;
		
	}
	
	/*----------------------------------------------------------------- */
	/**
	 [메소드이름]: doPost<br>
	 [기능]: 사원 등록 또는 변겨을 한 후 모든 사원을 보여준다.<br>
	 [파라미터]: HttpServletRequest request, HttpServletResponse response<br>
	 [호출자] : 사용자<br>
	 */
	/*--------------------------------------------------------------- */		
	public void doPost (
		HttpServletRequest request ,
		HttpServletResponse response ) throws ServletException , IOException
	{
		PrintWriter out ;
		String head = " 팬더 소프트 " ;
		// Set content type and other response header fields first
		response.setContentType ( "text/html;charset=euc-kr" ) ;
		// then write the data of the response
		out = new PrintWriter ( new OutputStreamWriter ( response.getOutputStream ( ) , "EUC-KR" ) ) ;
		
		/////////////////////////////////////////////
		// 세션 확인 부분 - 인증되지 않은 사용자의 경우 Login.html 로 되돌려 보낸다.
		String authenKind = null ;
		String authenId = null ;
		String authenName = null ;
		String authenLoginStatus = null;
		
		HttpSession session = request.getSession ();
		authenLoginStatus =  (String)session.getValue("Authentication");
		
		if( (authenLoginStatus == null) || ( !(authenLoginStatus.equals("true")) ) ){
			session.invalidate();
			response.sendRedirect("../Login.html");
		} else {
			authenKind = (String)session.getValue("Kind");
			authenId = (String)session.getValue("Id");
			authenName = (String)session.getValue("Name");   
		}
		/////////////////////////////////////////////
		
		// 파일을 서버에 저장하기 위해서 InputStream을 PareseRequestData로 바꾸어 준다. 
		ParseRequestData pD = new ParseRequestData ( request.getInputStream() ) ;
		
		String page = pD.getParameter("page");		
		page = new String ( page.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		
		// 데이타베이스에서 얻어들 모든 사원의 내용으로 String의 배열형태이다.
		Official[] allOfficial = null ;
		
		// 한글 처리를 위해서 Form에서 넘어오는지 아닌지를 알아낸다.
		boolean isForm = false ;
		if ( pD.getParameter("form") != null ) isForm = true ;
		boolean isUpdate = false ;
		if ( pD.getParameter("update").equals("yes") ) isUpdate = true ;
		pD.getParameter("trueadd") ;
		
		// 입력과 변경의 경우에 실행되는 메서드이므로 파라미터를 순서대로 받는다. 
		String id = pD.getParameter("id") ;		
		id = new String ( id.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		String password = null ;
		String residentRegistrationNum = null ;			
		password = pD.getParameter("password") ;
		password = new String ( password.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		pD.getParameter("password2") ;
		residentRegistrationNum = pD.getParameter("residentRegistrationNum") ;
		residentRegistrationNum = new String ( residentRegistrationNum.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		int sex = Integer.parseInt ( pD.getParameter("sex") ) ;
		String familyName = null ;
		familyName = pD.getParameter("familyName") ;
		familyName = new String ( familyName.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		String firstName = pD.getParameter("firstName") ;
		firstName = new String ( firstName.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		String orders = pD.getParameter("orders") ;
		orders = new String ( orders.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		int age = 0 ;
		age = Integer.parseInt ( pD.getParameter("age") ) ;		
	  	String upDep = pD.getParameter ( "department" ) ;
		upDep = new String ( upDep.getBytes("ISO-8859-1") , "EUC-KR" ) ;			
		// 부서를 체크해서 넣는다
		// 그러나 변경일 경우는 체크해서 넣는것이 아니다.
		if ( !isUpdate ) upDep = upDep.substring( 0, upDep.indexOf(";") );
	  	String o2 = upDep ;
  		String name = pD.getParameter ( "team" ) ;
		name = new String ( name.getBytes("ISO-8859-1") , "EUC-KR" ) ;	
	  	String o1 = name ;
		String department = upDep ;
		String team = name ;
		String phoneNumber = null ;
		phoneNumber = pD.getParameter("phoneNumber") ;
		phoneNumber = new String ( phoneNumber.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		String faxNumber = null ;
		faxNumber = pD.getParameter("faxNumber") ;
		faxNumber = new String ( faxNumber.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		String personalPhone = null ;
		personalPhone = pD.getParameter("personalPhone") ;
		personalPhone = new String ( personalPhone.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		String homePhoneNumber = null ;
		homePhoneNumber = pD.getParameter("homePhoneNumber") ;
		homePhoneNumber = new String ( homePhoneNumber.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		String address = pD.getParameter("address") ;
		address = new String ( address.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		String zipCode = null ;
		zipCode = pD.getParameter("zipCode") ;
		zipCode = new String ( zipCode.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		int userKind = Integer.parseInt ( pD.getParameter ( "userKind") ) ;
		int year = Integer.parseInt ( pD.getParameter("year") ) ;
		int month = Integer.parseInt ( pD.getParameter("month") ) ;
		int day = Integer.parseInt ( pD.getParameter("day") ) ;
		String weightWork = pD.getParameter("weightWork") ;		
		weightWork = new String ( weightWork.getBytes("ISO-8859-1") , "EUC-KR" ) ;
		String others = pD.getParameter("others") ;		
		others = new String ( others.getBytes("ISO-8859-1") , "EUC-KR" ) ;
			
		String filePath = "c:/groupware/file/org" ;
		String fileName = id ;
		
		// String[] fnames = pD.saveFile(filePath, fileName);
		// 서버에 파일이 저장됩니다.
		
		Vector attachedFiles = pD.getAttachedFileNames();
		String fName = null ;
		
		if(!attachedFiles.isEmpty()){
			for(int i=0; i<attachedFiles.size() ; i++){
				try {
					//pD.saveFile((String)attachedFiles.elementAt(i), filePath, fileName);
					pD.saveFile(filePath, fileName);
				} catch ( Exception e ) { }
				fName = fileName + "-" + attachedFiles.elementAt(i) ;
			}  
		}
     	
		Official newOfficial = new Official ( ) ;
			
		newOfficial.setId ( id ) ;
		newOfficial.setPassword ( password ) ;
		newOfficial.setResidentRegistrationNum ( residentRegistrationNum ) ;
		newOfficial.setFirstName ( firstName ) ;
		newOfficial.setFamilyName ( familyName ) ;
		if ( sex == 1 ) newOfficial.setSex ( true ) ;
		else newOfficial.setSex ( false ) ;
		newOfficial.setAge ( age ) ;
		newOfficial.setAddress ( address ) ;
		newOfficial.setZipCode ( zipCode ) ;
		newOfficial.setPhoneNumber ( phoneNumber ) ;
		newOfficial.setPersonalPhone ( personalPhone ) ;
		newOfficial.setWeightWork ( weightWork ) ;
		newOfficial.setDepartment ( department ) ;
		newOfficial.setTeam ( team ) ;
		newOfficial.setOrders ( orders ) ;
		Calendar enterCompanyDay = Calendar.getInstance ( ) ;
		enterCompanyDay.set ( Calendar.YEAR , year ) ;
		enterCompanyDay.set ( Calendar.MONTH , month ) ;
		enterCompanyDay.set ( Calendar.DATE , day ) ;
		newOfficial.setEnterCompanyDay ( enterCompanyDay ) ;
		newOfficial.setHomePhoneNumber ( homePhoneNumber ) ;
		newOfficial.setFaxNumber ( faxNumber ) ;
		newOfficial.setOthers ( others ) ;
		if ( userKind == 0 ) newOfficial.setUserKind ( 0 ) ;
		else newOfficial.setUserKind ( 1 ) ;
		newOfficial.setImagePath ( fName ) ;
				
		if ( isUpdate ) {
			// 변경하기 버튼을 눌렀을 경우....
			OrganizationResultStatus ors = omc.updateOfficial ( newOfficial ) ;
			if ( ors.getResultStatus() == 1 ) {
				// 변경하는것에 실패했을 경우
				out.println ( "<html><head><title>에러</title></head>" ) ;
				out.println ( "<body><p align=\"center\">에러가 발생했습니다.</p>" ) ;
				out.println ( "<p align=\"center\">" + ors.getReason() + "</p>" ) ;
				out.println ( "<p align=\"center\"><input type=\"button\" name=\"update\" value=\"되돌아 가기\" onClick=\"history.back();\"></p>" ) ;
				out.println ( "</body></html>" ) ;
				out.close ( ) ;
			} 
		} else {
			// 등록하기 버튼을 눌렀을 경우...
			OrganizationResultStatus ors = omc.addOfficial ( newOfficial ) ;
			if ( ors.getResultStatus() == 1 ) {
				// 입력하는것에 실패했을 경우
				out.println ( "<html><head><title>에러</title></head>" ) ;
				out.println ( "<body><p align=\"center\">에러가 발생했습니다.</p>" ) ;
				out.println ( "<p align=\"center\">이미 존재하는 사원 아이디입니다.</p>" ) ;
				out.println ( "<p align=\"center\">" + ors.getReason() + "</p>" ) ;
				out.println ( "<p align=\"center\"><input type=\"button\" name=\"add\" value=\"되돌아 가기\"  onClick=\"history.back();\"></p></form>" ) ;
				out.println ( "</body></html>" ) ;
				out.close ( ) ;
			}
		}
		// 이름이 넘겨받은 팀인 팀 객체를 하나 생성한다.
		Team ateam = new Team ( ) ;
		ateam.setName ( name ) ;
		ateam.setUpDepartment ( upDep ) ;
		
		// 데이타 베이스에서 파라미터로 넘겨주는 팀의 모든 사원의 내용을 가져온다.
		allOfficial = omc.getAllOfficial ( ateam ) ;
		if ( upDep.equals ( "null" ) && name.equals ( "null" ) ) response.sendRedirect("/servlet/ShowAllDepartmentServlet?page=1&up=true" );
		if ( !(upDep.equals ( "null" )) && name.equals ( "null" ) ) response.sendRedirect("/servlet/ShowAllDepartmentServlet?page=1&up=true" ) ;
	
		out.println ( "<html><head><title>팬더 소프트" + upDep + name + "</title>" ) ;

		out.println ( "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=euc-kr\">" ) ;
		out.println ( "<style type=\"text/css\">" ) ;
		out.println ( "BODY {font-size:9pt; color:\"#000000\"; line-height:14px;}" ) ;
		out.println ( "A:Link {font-size:9pt; color:\"#000033\"; line-height:14px; text-decoration:none}" ) ;
		out.println ( "A:Visited {font-size:9pt; color:\"#330033\"; line-height:14px; text-decoration:none}" ) ;
		out.println ( "A:Hover {font-size:9pt; color:\"#0000ff\"; line-height:14px; text-decoration:underline}" ) ;
		out.println ( "td {font-size:9pt;}" ) ;
		out.println ( "td.red {font-size:9pt; color:\"#ff0000\"}" ) ;
		out.println ( "td.black {font-size:9pt; color:\"#000000\"}" ) ;
		out.println ( "td.navy {font-size:9pt; color:\"#000066\"}" ) ;
		out.println ( "td.space {font-size:1pt;}" ) ;
		out.println ( "</style>  </HEAD>" ) ;

		out.println ( "<body>" ) ;
		out.println ( "<p align=right><img src=\"/image/우측_관리기능.gif\" alt=\"관리 기능\"></p>" ) ;
		
		out.println ( "<script language=\"JavaScript\">" ) ;
		out.println ( "<!--" ) ;
		out.println ( "	function updateOrgTree()" ) ;
		out.println ( "	{ " ) ;
		out.println ( "		parent.frames[\'contents\'].location=\"/servlet/ShowOrganizationTreeServlet\"; " ) ;
		out.println ( "	} " ) ;
		out.println ( "//-->" ) ;
		out.println ( "</script>" ) ;
		out.println ( "<form><table border=0 hspace=4 width=800 cellpadding=3><tr width=800><td width=340>" ) ;	
		out.println ( "<a href=\"/servlet/ShowOrganizationTreeServlet\" target=\"contents\" onClick=\"parent.frames[\'detail\'].location=\'/orgdetail.html\'\">조직관리</a>    >>    <a href=\"/servlet/ShowAllTeamServlet?page=1&name=" + upDep + "\">" + upDep + "</a></font>" ) ;
		out.println ( "</td><td width=460 align=right>" ) ;
		out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchDepartmentServlet?add=add\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].depAdd.src='/image/부서등록-1.jpg'\" onMouseOut=\"document.forms[0].depAdd.src='/image/부서등록.jpg'\"><img name=depAdd src=\"/image/부서등록.jpg\"></a>" ) ;
		out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchDepartmentServlet?search=search\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].depSea.src='/image/부서검색-1.jpg'\" onMouseOut=\"document.forms[0].depSea.src='/image/부서검색.jpg'\"><img name=depSea src=\"/image/부서검색.jpg\"></a>" ) ;
		out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchTeamServlet?add=add&upDep=upDep\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].temAdd.src='/image/팀등록-1.jpg'\" onMouseOut=\"document.forms[0].temAdd.src='/image/팀등록.jpg'\"><img name=temAdd src=\"/image/팀등록.jpg\"></a>" ) ;
		out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchTeamServlet?search=search&upDep=upDep\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].temSea.src='/image/팀검색-1.jpg'\" onMouseOut=\"document.forms[0].temSea.src='/image/팀검색.jpg'\"><img name=temSea src=\"/image/팀검색.jpg\"></a>" ) ;
		out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchOfficialServlet?add=add&upDep=null&team=null\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].offAdd.src='/image/사원등록-1.jpg'\" onMouseOut=\"document.forms[0].offAdd.src='/image/사원등록.jpg'\"><img name=offAdd src=\"/image/사원등록.jpg\"></a>" ) ;
		out.println ( "<a onClick=\"parent.frames[\'detail\'].location=\'/servlet/AddSearchOfficialServlet?search=search&upDep=null&team=null\'\" style=\"cursor:hand;\" onMouseOver=\"document.forms[0].offSea.src='/image/사원검색-1.jpg'\" onMouseOut=\"document.forms[0].offSea.src='/image/사원검색.jpg'\"><img name=offSea src=\"/image/사원검색.jpg\"></a>" ) ;
		out.println ( "</td></tr><tr width=800 valign=middle bgcolor=\"#3399ff\"><td colspan=2 width=800><nobr><FONT color=#ffffff>" + name + "의 모든 사원 보기" + "</nobr></td></tr></table></form>" ) ;
		
		out.println ( "<p><p><!--------바뀌는  테이블------------>" ) ;
		out.println ( "<!--td align=\"center\" valign=\"top\"--> " ) ;
		out.println ( "<p><p><center><table width=\"731\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> " ) ;
		out.println ( "  <tr> " ) ;
		out.println ( "    <td width=\"10\">&nbsp;</td>" ) ;
		out.println ( "    <td width=\"10\">&nbsp;</td>"  ) ;
		out.println ( "    <td width=\"711\">&nbsp;</td>" ) ;
		out.println ( "  </tr>  <tr> " ) ;
		out.println ( "    <td width=\"10\">&nbsp;</td>" ) ;
		out.println ( "    <td width=\"10\">&nbsp;</td>" ) ;
		out.println ( "    <td width=\"711\">&nbsp;</td>" ) ;
		out.println ( "  </tr>  <tr> " ) ;
		out.println ( "    <td width=\"10\">&nbsp;</td>" ) ;
		out.println ( "    <td width=\"10\">&nbsp;</td>" ) ;
		out.println ( "    <td width=\"711\">&nbsp;</td>" ) ;
		out.println ( "  </tr></table>" ) ;
		out.println ( "<table width=\"710\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">" ) ;
		out.println ( "	<tr>	<td>&nbsp;&nbsp;&nbsp;</td>	<td>" ) ;
		out.println ( "<table border=0 cellpadding=2 cellspacing=0 bgcolor=#3399ff>" ) ;
		out.println ( "<tr><td width=600>" ) ;
		out.println ( "<table width=\"710\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">" ) ;
		out.println ( "	<tr>	<td width=130 align=center bgcolor=#3399ff>사원 ID</td>" ) ;
		out.println ( "	<td width=130 align=center bgcolor=#3399ff>사원 이름</td>" ) ;
		out.println ( "	<td width=190 align=center bgcolor=#3399ff>사원 주민등록번호</td>" ) ;
		out.println ( "	<td width=130 align=center bgcolor=#3399ff>사원 직급</td>" ) ;
		out.println ( "	<td width=130 align=center bgcolor=#3399ff>사원 성별</td>" ) ;
		out.println ( "	</tr>" ) ;
		
		////////////////////////////////////////////////////
		// 페이지를 위해 부서의 갯수를 알아내자....
		int dbNumber = 0 ;
		for ( dbNumber = 0 ; !(allOfficial[dbNumber].getId().equals("null")) ; dbNumber++ ) { }
		// 지금부터는 [dbNumber] 가 총 부서의 갯수이다.
		////////////////////////////////////////////////////
		// 이제 총 페이지의 갯수를 알아내자..
		int pageNumber = dbNumber/4 ;
		if ( dbNumber%4 != 0 ) pageNumber++ ;
		// 파라미터로 현재 페이지를 얻어낼수 있다.
		//String page = pD.getParameter ( "page" ) ;
		// 파라미터로 넘어온 현재 페이지는 curPage이다.
		int curPage = Integer.parseInt ( page ) ;
		// 현재 페이지의 수에 맞추어서 튜플을 건너 뛰어야한다.
		int loop = ((curPage-1)*4) ;
		/////////////////////////////////////////////////
		// 라스트 페이지를 구해보자.
		int last = 0 ;
		if ( (pageNumber%3)==1 ) last = pageNumber ;
		else if ( (pageNumber%3)==2 ) last = pageNumber-1 ;
		else if ( (pageNumber%3)==0 ) last = pageNumber-2 ;
		String lastPage = new String ( Integer.toString ( last ) ) ;
		// Pre 페이지를 구해보자.
		int pre = 0 ;
		if ( (curPage%3)==1 ) pre = curPage-3 ;
		else if ( (curPage%3)==2 ) pre = curPage-4 ;
		else if ( (curPage%3)==0 ) pre = curPage-5 ;
		String prePage = new String ( Integer.toString ( pre ) ) ;
		// Next 페이지를 구해보자.
		int next = 0 ;
		if ( (curPage%3)==1 ) next = curPage+3 ;
		else if ( (curPage%3)==2 ) next = curPage+2 ;
		else if ( (curPage%3)==0 ) next = curPage+1 ;
		String nextPage = new String ( Integer.toString ( next ) ) ;
		// curPage에 대한 것들을 String으로 바꾸자.
		// curPage ( int ) 이고 page ( String ) 입니다.
		String mmPage = new String ( Integer.toString ( curPage-2 ) ) ;
		String mPage = new String ( Integer.toString ( curPage-1 ) ) ;
		String pPage = new String ( Integer.toString ( curPage+1 ) ) ;
		String ppPage = new String ( Integer.toString ( curPage+2 ) ) ;
		/////////////////////////////////////////////////////////////////
		boolean stop = false ;						
			
		out.println ( "    <tr>" ) ;
		if ( allOfficial[loop].getId().equals("null") ) {
			stop = true ;
			out.println ( "<TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD>" ) ;
		} else {
				out.println ( "<TD bgcolor=\'#f7f7f7\'><a href=\"" 
														+ "/servlet/ShowOneOfficialServlet?id=" + allOfficial[loop].getId() 
														+ "&department=" + allOfficial[loop].getDepartment() 
														+ "&team=" + allOfficial[loop].getTeam() 
														+ "\" target=\"detail\">" + allOfficial[loop].getId() + "</A></TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getFamilyName() + " " + allOfficial[loop].getFirstName() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getResidentRegistrationNum() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getOrders() + "</TD>" ) ;
				String asex = new String ( ) ;
				if ( allOfficial[loop].getSex() ) asex = "남자" ;
				else asex = "여자" ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + asex + "</TD>" ) ;
				loop++ ;
		}
			out.println ( "    </tr>" ) ;
			out.println ( "    <tr>" ) ;

			if ( allOfficial[loop].getId().equals("null") ) {
				stop = true ;
				out.println ( "<TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD>" ) ;
			} else {
				out.println ( "<TD bgcolor=\'#f7f7f7\'><a href=\"" 
														+ "/servlet/ShowOneOfficialServlet?id=" + allOfficial[loop].getId() 
														+ "&department=" + allOfficial[loop].getDepartment() 
														+ "&team=" + allOfficial[loop].getTeam() 
														+ "\" target=\"detail\">" + allOfficial[loop].getId() + "</A></TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getFamilyName() + " " + allOfficial[loop].getFirstName() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getResidentRegistrationNum() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getOrders() + "</TD>" ) ;
				String bsex = new String ( ) ;
				if ( allOfficial[loop].getSex() ) bsex = "남자" ;
				else bsex = "여자" ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + bsex + "</TD>" ) ;

				loop++ ;
			}
			out.println ( "    </tr>" ) ;
			out.println ( "    <tr>" ) ;
			if ( (allOfficial[loop].getId().equals("null")) || (stop==true) ) {
				stop = true ;
				out.println ( "<TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD>" ) ;
			} else {
				out.println ( "<TD bgcolor=\'#f7f7f7\'><a href=\"" 
														+ "/servlet/ShowOneOfficialServlet?id=" + allOfficial[loop].getId() 
														+ "&department=" + allOfficial[loop].getDepartment() 
														+ "&team=" + allOfficial[loop].getTeam() 
														+ "\" target=\"detail\">" + allOfficial[loop].getId() + "</A></TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getFamilyName() + " " + allOfficial[loop].getFirstName() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getResidentRegistrationNum() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getOrders() + "</TD>" ) ;
				String csex = new String ( ) ;
				if ( allOfficial[loop].getSex() ) csex = "남자" ;
				else csex = "여자" ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + csex + "</TD>" ) ;

				loop++ ;
			}
			out.println ( "    </tr>" ) ;
			out.println ( "    <tr>" ) ;
			if ( (allOfficial[loop].getId().equals("null")) || (stop==true) ) {
				out.println ( "<TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD><TD bgcolor=\'#f7f7f7\'>&nbsp;</TD>" ) ;
			} else {
				out.println ( "<TD bgcolor=\'#f7f7f7\'><a href=\"" 
														+ "/servlet/ShowOneOfficialServlet?id=" + allOfficial[loop].getId() 
														+ "&department=" + allOfficial[loop].getDepartment() 
														+ "&team=" + allOfficial[loop].getTeam() 
														+ "\" target=\"detail\">" + allOfficial[loop].getId() + "</A></TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getFamilyName() + " " + allOfficial[loop].getFirstName() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getResidentRegistrationNum() + "</TD>" ) ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + allOfficial[loop].getOrders() + "</TD>" ) ;
				String dsex = new String ( ) ;
				if ( allOfficial[loop].getSex() ) dsex = "남자" ;
				else dsex = "여자" ;
				out.println ( "<TD align=center bgcolor=\'#f7f7f7\'>" + dsex + "</TD>" ) ;
			}
			out.println ( "    </tr>" ) ;		
			out.println ( "</table>" ) ;
			out.println ( "			<!----------------------------------글 리스트보여주는 테이블의 끝-------------------------->" ) ;
			out.println ( "</td></tr></table>" ) ;
			out.println ( "<!----------------------------------글 리스트 보여주는 테이블을 약간 오른쪽으로 하기위한 큰 테이블의 끝 ------->" ) ;
			out.println ( "</td></tr></table></center><br>" ) ;
			
			out.println ( "<table align=center><tr align=center>" ) ;			

		// 페이지의 숫자를 이용하여 몇번째 tuple부터 가져올지를 알 수 있다.
		// 그래서 4개의 데이타를 모두 써주 었다.
		// 이제 마지막 줄은 여러가지 형태로 나올 수 있다.
		if ( pageNumber == 0 ) {
			// 데이타 베이스에 데이타가 하나도 없는 경우이다.
			//out.println ( "<p align=\"center\">이 팀에는 사원이 존재하지 않습니다.</p> " ) ;
			//out.println ( "<p align=\"center\">새로운 사원을 등록하여 주십시요.</p> " ) ;
		} else	if ( curPage == 1 ) {
			if ( pageNumber == 1 ) {
				// 총 페이지가 1개인 경우이다. 이때는 [1] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[1]</font></TD> " ) ;
			} else if ( pageNumber == 2 ) {
				// 총 페이지가 2개인 경우이다. 이때는 [1][2] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[1]</font></TD> " ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=2\">[2]</a></TD> " ) ;
			} else if ( pageNumber == 3 ) {
				// 총 페이지가 3개인 경우이다. 이때는 [1][2][3] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[1]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=2\">[2]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=3\">[3]</a></TD> " ) ;
			} else if ( pageNumber > 3 ) {
				// 총 페이지가 4개 이상인 경우이다. 이때는 [1][2][3] [next] [last] 의 형태이다. 
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[1]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=2\">[2]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=3\">[3]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=4\">[Next]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + lastPage + "\">[Last]</a></TD>" ) ;
			}
		} else if ( curPage == 2 ) {
			if ( pageNumber == 1 ) {
				// 잘못된 파라미터이다.
				out.println ( "<TD align=middle vAlign=center height=21>잘못된 파라미터 입니다.</TD> " ) ;
			} else if ( pageNumber == 2 ) {
				// 총 페이지가 2개인 경우 이다. 이때는 [1][2] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[1]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[2]</font></TD> " ) ;
			} else if ( pageNumber == 3 ) {
				// 총 페이지가 3개인 경우이다. 이때는 [1][2][3] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[1]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[2]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=3\">[3]</a></TD> " ) ;
			} else if ( pageNumber > 3 ) {
				// 총 페이지가 4개 이상인 경우이다. 이때는 [1][2][3] [next] [last] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[1]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[2]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=3\">[3]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=4\">[Next]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + lastPage + "\">[Last]</a></TD>" ) ;
			}						
		} else if ( curPage == 3 ) {
			if ( pageNumber == 1 ) {
				// 잘못된 파라미터이다.
				out.println ( "<TD align=middle vAlign=center height=21>잘못된 파라미터 입니다.</TD> " ) ;
			} else if ( pageNumber == 2 ) {
				// 잘못된 파라미터이다.
				out.println ( "<TD align=middle vAlign=center height=21>잘못된 파라미터 입니다.</TD> " ) ;
			} else if ( pageNumber == 3 ) {
				// 총 페이지가 3개인 경우이다. 이때는 [1][2][3] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[1]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=2\">[2]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[3]</font></TD> " ) ;
			} else if ( pageNumber > 3 ) {
				// 총 페이지가 4개 이상인 경우이다. 이때는 [1][2][3] [next] [last] 의 형태이다.
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[1]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=2\">[2]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[3]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=4\">[Next]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + lastPage + "\">[Last]</a></TD>" ) ;
			}					
		} else if ( (((curPage%3)==1)&&((curPage+2)<pageNumber)) || (((curPage%3)==2)&&((curPage+1)<pageNumber)) || (((curPage%3)==0)&&(curPage<pageNumber)) ) {
			// 현재 파라미터로 넘어온 페이지가 [first][pre][x][x][x][next][last]  의 형태일 경우..
			if ( (curPage%3)==1 ) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + pPage + "\">[" + pPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + ppPage + "\">[" + ppPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + nextPage + "\">[Next]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + lastPage + "\">[Last]</a></TD>" ) ;
			} else if ( (curPage%3)==2) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mPage + "\">[" + mPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + pPage + "\">[" + pPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + nextPage + "\">[Next]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + lastPage + "\">[Last]</a></TD>" ) ;
			} else if ( (curPage%3)==0) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mmPage + "\">[" + mmPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mPage + "\">[" + mPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + nextPage + "\">[Next]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + lastPage + "\">[Last]</a></TD>" ) ;
			}
		} else if ( (pageNumber%3)==1 ) {
			// 현재 파라미터로 넘어온 페이지가 [first][pre][x] 의 형태일 경우...
			out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
			out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
			out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
		} else if ( (pageNumber%3)==2 ) {
			// 현재 파라미터로 넘어온 페이지가 [first][pre][x][x] 의 형태일 경우...
			if ( (curPage%3)==1 ) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + pPage + "\">[" + pPage + "]</a></TD>" ) ;
			} else if ( (curPage%3)==2 ) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mPage + "\">[" + mPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
			}
		} else if ( (pageNumber%3)==0 ) {
			// 현재 파라미터로 넘어온 페이지가 [first][pre][x][x][x] 의 형태일 경우...
			if ( (curPage%3)==1 ) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + pPage + "\">[" + pPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + ppPage + "\">[" + ppPage + "]</a></TD>" ) ;
			} else if ( (curPage%3)==2 ) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mPage + "\">[" + mPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + pPage + "\">[" + pPage + "]</a></TD>" ) ;
			} else if ( (curPage%3)==0 ) {
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=1\">[First]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + prePage + "\">[Pre]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mmPage + "\">[" + mmPage + "]</a></TD>"  ) ;
				out.println ( "<TD align=middle vAlign=center height=21><a href=\"/servlet/ShowAllOfficialServlet?name=" + name + "&upDep=" + upDep + "&page=" + mPage + "\">[" + mPage + "]</a></TD>" ) ;
				out.println ( "<TD align=middle vAlign=center height=21><font color=#ff0000>[" + page + "]</font></TD>" ) ;
			}
		}
		out.println ( "</tr></table><br>" ) ;

		out.println ( "<br>" ) ;
		out.println ( "<CENTER><TABLE width=700 border=0 cellPadding=2 cellSpacing=1>" ) ;
		out.println ( "  <TR><TD align=right>" ) ;
		out.println ( "<form action=\"/servlet/ShowOneTeamServlet?\" method=\"GET\">" ) ;
		out.println ( "<input type=\"hidden\" name=\"property\" value=\"" + name + "\">" ) ;
		out.println ( "<input type=\"hidden\" name=\"upDep\" value=\"" + upDep + "\">" ) ;
		out.println ( "<INPUT type=submit name=detail value=\"" + name + " 상세 정보\">&nbsp;&nbsp;&nbsp;&nbsp;</form>" ) ;
		out.println ( "</TD></TR></TABLE><CENTER>" ) ;
		out.println ( "</body></html>" ) ;
				
		out.close ( ) ;
	}	
}