//Google AdSense

웹서버를 실행시키고 html, css로 화면을 구성

 

 

 


개발환경 세팅 

 

 

개발환경 다운로드 사이트

1) 자바프로그램 개발 을 위해서 필수 다운로드 및 설치

http://www.oracle.com

 

Oracle | Integrated Cloud Applications and Platform Services

About Oracle Unlock endless possibilities A culture of innovation has propelled Oracle since its inception. Today, thanks to exceptional people, we lead the market in autonomous, cloud, and applications technologies.

www.oracle.com

JDK ( Java SE Development Kit ) : 개발환경

JRE ( Server Java Runtime Environment ) : 실행환경

2)웹서버(Web Server) ,웹어플리케이션서버 (Web Application Server)

apache-tomcat

http://tomcat.apache.org/

 

Apache Tomcat® - Welcome!

The Apache Tomcat® software is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies. The Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket specifications are

tomcat.apache.org

3)편집 도구 : eclipse

http://eclipse.org/

 

The Platform for Open Innovation and Collaboration | The Eclipse Foundation

The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 350 open source projects, including runtimes, tools and frameworks.

www.eclipse.org

 

( eclipse&apache-tomcat > 특정 폴더에 위치시키는 개념)

 

 

이클립스 편집도구를 통해 JDK, JRE와 웹서버를 연결하여 프로젝트를 생성한다.

 


워크스페이스 설정

 

이클립스를 실행하기 전에 워크스페이스를 생성한다.

 

D드라이브 이름폴더 하위에 htmlwork35 폴더를 생성했다.

 

이클립스를 실행하면 워크스페이스를 설정하라는 창이 뜬다.

 

워크스페이스로 생성한 htmlwork35의 절대경로를 입력한다.

 

 

<절대경로와 상대경로>


1.절대경로

원하는 경로를 Root 디렉터리부터 모두 적은 것
어떠한 웹페이지나 파일이 가지고 있는 고유한 경로


ex)
http://www.naver.com
C:\users\document\untitled.jpg


2. 상대경로

 현재 위치한 곳을 기준으로 한 그곳의 위치

  ex)
C:\users\document를 기준으로
C:\users\document\ex\untitled.jpg > \ex\untitled.jpg
C:\users\document > ./
C:\users > ../

 

 


새 프로젝트 생성

 

 

File> New> Dynamic Web Project로 새 프로젝트를 생성한다.

 

프로젝트 이름을 ex라고 적었다.

 

 

Target runtime은 웹서버를 의미한다.

new runtime을 선택해 웹 서버 타입을 Apache Tomcat v9.0로 선택한다.

 

tomcat installation directory 설정을 위해 browse를 클릭해 경로를 설정한다.

 

 

src는 JAVA 소스 코드의 위치이고

classes 는 compile, building 시 나오는 class 파일의 위치이다.

 

 

 

context root 와 project name이 같은 것을 확인할 수 있다.

 

WebComtent 하위에 html, css, Java Script, JQuery 등이 위치한다.

 

Finish를 눌러 프로젝트 생성을 마친다.

 

 

 

생성된 프로젝트 ex

 

이클립스에서 보여지는 프로젝트의 경로와 Windows에서 보여지는 폴더의 경로가 유사하면서도 차이점을 보인다.

 


웹 서버 서비스 해보기

 

프로젝트 탐색기에서 WebContent 폴더를 선택하고 JSP File을 생성한다.

 

 

생성된 JSP 파일 내용 <body>안에 통성명을 해보았다.

 

내용을 작성 후 run을 한다. run단축키는 ctrl+F11이다

 

Run을 하게되면 이런 창이 뜨는데 프로젝트 생성시에 설정했던 target runtime과 알맞은 apache-tomcat의 버전과 동일한지 확인한 뒤  Finish를 눌러준다.

 

내용이 잘 출력된 모습!

+ Recent posts