ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [프로젝트 환경설정]
    Web 2019. 8. 9. 18:38

    1. JDK설치

    - 환경설정

    JAVA_HOME: C:\Program Files\Java\jdk1.x.x

    path: %JAVA_HOME%\bin 최상단에

    classpath: .

     

    2. 이클립스 설치

     

    3. DBMS설치

    - 계정생성

    - 권한부여

     

    4. Apache-Tomcat설치(압축버젼)

    - 압축풀기: C:\apache-tomcat-8.5.42

     

    5. 이클립스 설정

    - 인코딩 설정

    - 서버설정

      - server.xml

      - 포트 변경 확인

      - 

      - iBatis 설정

     




    <프로젝트 환경설정>

    [프로그램 설치]
    1. JDK설치
      - 위치(C:\Program Files\Java\jdk1.8.0_201), 버전(jdk1.8.0_201)을 일치
      - 환경설정
          JAVA_HOME  :  C:\Program Files\Java\jdk1.8.0_201
          path       :  %JAVA_HOME%\bin; 최고상단에
          classpath  :  .
          
    2. 이클립스 (JavaEE버전)
      - 압축풀기

    3. DBMS설치(Oracle)
      - 계정생성 (create user)
      - 권한부여 (grant)
      
    4. Apache-Tomcat설치(압축버전) 
      - 압축풀기 : C:\apache-tomcat-8.5.42
      
    ====================================================================
    [이클립스 설정]

    1. 인코딩설정
      - Window메뉴
      - Preferences
      - General
      - Workspace
        ==> Text file encoding
        ==> MS949 ----> UTF-8 변경       :저장포맷변경
      ------------------------------------------ 
      - Window메뉴
      - Preferences
      - Web
      - HTML Files
           Encoding : ISO 10646/Unicode(UTF-8)   :파일생성시 문서내의 선언값
      - JSP Files
           Encoding : ISO 10646/Unicode(UTF-8)   :파일생성시 문서내의 선언값

    2. Apache-Tomcat(서블릿  컨테이너) 서버설정
      - 이클립스 하단 프레임의 Servers탭 선택
      - 오른쪽마우스 클릭
         - new
         - server
           - Tomcat v8.5 Server선택
              - Server's host name :  localhost
              - Server name: Tomcat v8.5 Server(프로젝트명) 
                                              --------------
                                                                                    다른서버설정과의 구분
              - Server runtime environment: Tomcat v8.5 Server(프로젝트명) 
                  ==> 만약 두번 이상의 서버설정은 한다면
                      ==> 'Add..'링크 클릭
                           ==> Name: Apache Tomcat v8.5 (Coffee)
                           ==> Tomcat installaction direction: C:\apache-tomcat-8.5.42

    2-2. Apache-Tomcat(서블릿  컨테이너) 서버설정
      - 이클립스 좌측 프레임 Project Explorer
         - Servers프로젝트
            - 2번에서 설정한 서버 선택(예:Tonmcat v8.5 Server(Coffee)-config)
               - server.xml 열기
               - 대략 60번 라인 정도 (포트번호 변경)
                  원래포트
                  변경포트 확인
                 
      - 이클립스 하단 Servers탭 더블클릭
          --> Modules탭 선택
          --> Path값 확인 (예: /Coffee)
                  ---> 'Edit'버튼을 통해  'WebContextRoot'변경 가능
                      (예:  /Coffee  ---->   /  ) 
          
    3. 이클립스에서 DB연결 
       ==> sqlplus, SqlDeveloper, 토드 와 같은 역할
       
        이클립스 좌측 프레임 Data Source Explorer
      - Database Connections 오른쪽 마우스 클릭
           - Oracle선택 (DBMS종류 선택)
           - Name: 커넥션이름설정(예: MyOracle)
           - Next버튼클릭   
               - Drivers 우측의 '당구장'이미지 클릭 
                   - Name/Type 탭  : Oracle Thin Dirver 11버전선택
                   - JAR List탭  : 기존 ojdbc14.jar 선택후  'Remove'버튼 통한 삭제
                           -->  'Add JAR'를 클릭하여 실제 존재하는 ojdbc6.jar 선택
                                  (선택후 결과: E:\jaelee\workspace2\struts\WebContent\WEB-INF\lib\ojdbc6.jar)
                                  (선택후 결과: E:\jaelee\util\driver\ojdbc6.jar)
                   - Properties탭
                         Connection URL  ==> jdbc:oracle:thin:@localhost:1521:xe
                         Database Name   ==> xe
                         Driver Class    ==> oracle.jdbc.driver.OracleDriver
                         Password        ==> tiger
                         User ID         ==> scott
                         
                - 'Test Connection'버튼 클릭
                         ==> Ping succeeded! 메시지 얻으면 성공        
          
    4. iBatis설정 
       - jaelee(공유폴더)/util/iBatis/dtd의 파일 2개 복사
           sql-map-2.dtd
           sql-map-config-2.dtd
         ==> 복사위치 : E:\jaelee\util\dtd\파일복사 ※
             E:\jaelee\workspace2\struts\WebContent\dtd\파일복사 ◈
       
       - Window 메뉴
          - Preferences
             - XML
               - XML Catalog 선택
                              우측 'Add..'버튼 클릭해서 User Specified Entries 2개추가
                 [1번째] :  Location 의 값 입력
                       'Workspace...'버튼 ◈  또는   'File System...'버튼   ※
                        ==> sql-map-config-2.dtd 파일 선택

                    Key입력:  -//iBATIS.com//DTD SQL Map Config 2.0//EN

                    Alternative web addres 체크박스 v체크후  입력:
                       http://www.ibatis.com/dtd/sql-map-config-2.dtd
                                            
                 [2번째] :  Location 의 값 입력
                       'Workspace...'버튼 ◈  또는   'File System...'버튼   ※
                       ==> sql-map-2.dtd 파일 선택
                       
                    Key입력:  -//iBATIS.com//DTD SQL Map 2.0//EN

                    Alternative web addres 체크박스 v체크후  입력:
                       http://www.ibatis.com/dtd/sql-map-2.dtd
                                            
       - iba패키지 생성 (com.encore.db.iba)
           ==> MySqlMapClient.java   
                 : SqlMap관련XML파일들을 객체화 시키는 역할
                 : sqlMapConfig.xml파일 등록 
                 
           ==> conn.properties  (DB연결에 필요한 요소들정의, 옵션)
           ==> sqlMapConfig.xml (DataSource와 DB연결설정, sql작성 XML등록)
           
       - mappers패키지 생성 (com.encore.db.mappers)
           ==> emp.xml 작성후 sqlMapConfig.xml에 등록!!
               
    5. JSTL(JSP Standard Tag Library)설정
       - jaelee(공유폴더)/util/jstl/jstl-1.2jar파일 복사
       - 웹프로젝트 생성후    WebContextRoot(Coffee)/WebContent/WEB-INF/lib에 붙여넣기
       - 표준 외부태그,커스텀태그(JSP페이지 내에서 자바코드 생략)!!
         ==> JSP페이지 내에서 사용
               ==> <%@taglib  uri="경로"  prefix="접두사" %> 명시 후 사용
       
    6. 한글설정(파라미터 한글깨짐 방지)!!     
       - 사용자 필터클래스 작성 (EncFilter.java)
       
       package util.enc;
          
       public class EncFilter implements Filter{
     private String encType;
        
     @Override
     public void init(FilterConfig config) throws ServletException {
    encType = config.getInitParameter("encType");
     }//init

     @Override
     public void doFilter(ServletRequest request, ServletResponse response,FilterChain chain) throws IOException, ServletException {
        if(encType != null) {//web.xml에 encType이 정의되었다면
      request.setCharacterEncoding(encType);
        }else {
      request.setCharacterEncoding("UTF-8");//기본값
        }
    chain.doFilter(request, response);
    //다른 필터 혹은 요청 페이지와의 연결 진행
     }
        }
       
       - 필터설정 (WEB-INF/web.xml파일에  태그와 태그 추가)
       


       
         enc
         util.enc.EncFilter
         
           encType
           UTF-8
         
                     
                  
       
         enc
         /*
                   
         
         ※참고 
         /* 의 경우
         ==> http://192.168.0.96/struts/밑의 모든 요청에 대해 필터클래스의 doFiter()실행     
              
         *.jsp
         ==> http://192.168.0.96/struts/~/~/~.jsp
                   중간 경로(~/~/~)와 상관없이 .jsp로 끝나는 요청에 대해 필터클래스의 doFiter()실행     

         /guest/*
         ==> http://192.168.0.96/struts/guest/밑의 모든 요청에 대해 필터클래스의 doFiter()실행     

      

    반응형

    댓글

Designed by Tistory.