★ JAVA EE 개발자 환경 구축
① JAVA SE 개발환경이 구축 되어 있어야 한다(JDK가 설치되어 있어야 함).
② Oracle DataBase 개발환경이 구축 되어 있어야 한다.
③ 웹서버를 구축해야 한다. ▶ Tomcat Web Server
④ Tomcat Web Server 설치(등록)
- 검색창에서 tomcat 입력
- Apache Tomcat : http://tomcat.apache.org
- Download > Tomcat 8(https://tomcat.apache.org/download-80.cgi) > 8.5.54
- Binary Distributions > Core > 64-bit Windows zip : Download
- 압축해제 : apache-tomcat-8.5.54 폴더 복사
- C:\ 붙여넣기 → C:\tomcat 폴더 이름 변경
- 시스템 변수 설정
⑤ Port 번호 변경(Oracle DB Port와 Tomcat Port가 충돌)
- CMD Windows(Command) > sqlplus : User Name, Pass Word
- SQL>exec dbms_xdb.sethttpport(8888);
⑥ Eclipse와 Tomcat Server 연동
- D:\Study_Web\workspace 폴더 생성
- Eclipse 실행 > Launcher > Browse... > D:\Study_Web\workspace 변경 또는
File Menu Bar > Switch Workspace > Other > Browse > D:\Study_Web\workspace
- JAVE EE 변경 : Windows Menu Bar > Open Perspective > Others... > JAVA EE
- Windows Menu Bar > Show View > Servers > New Server...
- Apache > Tomcat v8.5 Server > Next
- Tomcat installation directory > Browse > C:\tomcat > Next > Finish
- C:\tomcat\lib\servlet-api.jar▶C:\Program Files\Java\jre1.8.0_241\lib\ext 붙여넣기
⑦ Eclipse와 Database 연동
- Windows Menu Bar > Show View > Data Source Explorer
- Database Connections > 마오 > New
- Connection Profile > Oracle > Next > New Driver Definition
- JAR List > Add JAR/Zip... > C:\ oraclexe\ app\ oracle\ product\ 11.2.0\ server\ jdbc\ lib\ ojdbc6.jar
⑧ Dynamic Web Project 생성
- Eclipse File Menu Bar > New > Dynamic Web Project
★ Build Path 설정 - 프로젝트 명 > 마오 > Build Path > Configure Build Path... - Default output folder 변경 : Source 탭 > Browse... - WebContent\WEB-INF\classes |
⑨ Dynamic Web Project와 Tomcat Server 연동
- Windows Menu Bar > Show View > Servers > Tomcat 8.5 >
마오 > Add and Remove > Project Add(Remove) > Finish
- Project Explorer Window > Servers > server.xml > Line Number 156
<Context docBase="01.FirstProject" path="/fp" ~~~/>
※ Context root 명이 중복될 경우 server.xml의 path값을 변경하면 된다. 변경한 후에 반드시 서버를 Restart 할 것.
※ Project Name > 마오 > Properties > Web Project Settings > Context root 변경하고, 서버를 Restart 할 것.
⑩ Web Programing(Java Resources > src), Web Page(WebContent) 제작
- 해당 폴더에서 마오 > New > Servlet, Class, package, html, css, javascript, JSP 등
- Eclipse 실행 : Run Menu Bar > Run As > Run on Server(Ctrl + F11)
- Web Browser 실행 : http://ServerIP주소:Port번호/Context root/Pagename.확장자
※ Encoding 변경
- Window MenuBar > Preferences > General
> Workspace > Text File encoding : UTF-8
- Window MenuBar > Preferences > Web > CSS, HTML, JSP : UTF-8
'For developer > Servlet&JSP' 카테고리의 다른 글
(Servlet)requestDispatcher (0) | 2020.05.12 |
---|---|
(Web.xml)Mapping 수동설정 하는 법 (0) | 2020.05.12 |