Servlet 과 JSP 의 실행,디 버 깅,컴 파일 환경 을 빠르게 만 듭 니 다.

Servlet 과 JSP 를 처음 배 운 많은 친구 들 이 어려움 을 겪 고 있다 고 믿 습 니 다.바로 Servlet 과 JSP 의 운행,디 버 깅 과 컴 파일 환경 을 어떻게 신속하게 구축 하 는 지 입 니 다.저 는 현재 외국 에서 MIT(Master of Information Technology)를 공부 하고 있 습 니 다.현재 선택 과목 은 WBIS(Web Based Information Systems)입 니 다.자바,Perl,CGI,Servlet,ASP,JavaScript,JSP,OO,UML 등 여러 가지 기술 을 포함 하고 있 습 니 다.아래 의 이 글 은 학교 에서 제공 하 는 관련 소프트웨어 의 다운로드 주소,설치 방법 과 관련 된 설명 입 니 다.그 중에서 필요 한 소프트웨어(학교 에서 이미 우리 에 게 CD 를 제공 했다)는 나 는 이미 모두 설치 하고 테스트 한 적 이 있 습 니 다.여기 서 저 는 여러분 께 강력 히 추천 합 니 다.전체 설치 과정 이 매우 간단 하기 때문에 아래 글 의 방법 에 따라 한 걸음 한 걸음 만 하면 100%성공 할 수 있 고 도움 이 될 것 이 라 고 믿 습 니 다.비록 문장 은 전부 영어 이지 만 매우 간단 해서 모두 가 이해 할 수 있 을 것 이 라 고 믿는다.만약 무슨 문제 가 있 으 면 모두 가 제기 해서 우리 가 함께 토론 할 수 있 기 를 바 랍 니 다.주:글 에서 언급 한 네 가지 소프트웨어 는 JDK 1.3.1,BlueJ 1.2.0,Apache Tomcat 4.0 과 bluej 이다.tomcat_config.zip。그 중에서 BlueJ 는 Servlet 을 만 들 고 컴 파일 하 는 데 사 용 됩 니 다.마지막 으로 그 zip 파일 은 BlueJ 와 Tomcat 을 설정 합 니 다.)BlueJ, Jakarta Tomcat and Java 2 SDK Installation1. Install the Java 2 Software Development Kit (JDK)It is recommended that you install JDK 1.3.1, which can be downloaded from here(http://www.csu.edu.au/faculty/sciagr/sis/subjects/itc357/j2sdk-1_3_1-win.exe), or from http://java.sun.com (unfortunately it is a 30M download so if you have a slow modem it may be better to acquire it on CD. For example, there is a CD containing JDK with many Java text books).Install JDK to the default directory, which is c:\jdk1.3.1You may use a different version of JDK (1.2 or later) but you will need to change the Tomcat configuration files startup.bat and shutdown.bat to point to the directory location.2. Install BlueJ (BlueJ is a basic Java editing and compilation environment that sits on top of JDK)It is recommended that you install BlueJ 1.2.0, which can be downloaded from here(http://www.csu.edu.au/faculty/sciagr/sis/subjects/itc357/bluejsetup-120.exe) or from http://bluej.orgInstall BlueJ to the default directory c:\BlueJIf you install a different version of BlueJ or place it in a different directory the configuration files provided in bluej_tomcat_config.zip will not automatically go into the correct directories and you will have to manually extract each one.3. Install Apache Tomcat (Tomcat is a Java web application server and will allow you to test your Servlets and JSP files locally)It is recommended that you install Apache Tomcat 4.0, which can be downloaded from here(http://www.csu.edu.au/faculty/sciagr/sis/subjects/itc357/jakarta-tomcat-4.0.4.exe) or from http://jakarta.apache.org/Install Tomcat to the default directory c:\Program Files\Apache Tomcat 4.0If you install a different version of Tomcat or place it in a different directory, you will need to configure it manually as the configuration files provided in bluej_tomcat_config.zip will not automatically go into the correct directories and various paths settings contained in them will not be correct.4. Configure BlueJ and Tomcat to work togetherThe recommended way to do this is to download the file bluej_tomcat_config.zip(http://www.csu.edu.au/faculty/sciagr/sis/subjects/itc357/bluej_tomcat_config.zip) and extract the files to the root directory on drive c:, making sure that you choose the option to use folder names.If you need to manually configure BlueJ or Tomcat, you need to troubleshoot problems or you want to examine the configuration options chosen, they are explained here.Compiling and Running Servlets on Your Local Machine1. Run BlueJ and open the existing project in the c:\Program Files\Apache Tomcat 4.0\webapps\testing\Web-inf\classes directory2. Create a new class and enter the code for your servlet, or use Edit-Add class from file to import an existing servlet source file.3. Compile the servlet.4. Start tomcat by double-clicking on startup.bat in the c:\Program Files\Apache Tomcat 4.0\bin directory. This will start Tomcat listening on port 8080 on your local machine (you don't need to be online).5. Start up your web browser and open the URL http://localhost:8080/testing/servlet/Servletname where Servletname is the name of your servlet.File locations and relative references within local and remote servletsHTML files located in a directory like c:\Program Files\Apache Tomcat 4.0\webapps\testing will be accessible through a URL like http://localhost:8080/testing/filename.htmlSimilarly if you place an HTML file in your home directory on the SWAP server it will be assessible through a URL like http://swap.csu.edu.au:8080/username/filename.htmlIf you need to place an image in a page generated by a servlet, you can place it in c:\Program Files\Apache Tomcat 4.0\webapps\testing (or on the swap server in your home directory) and refer to it in the HTML as ../imagename.jpg (eg. )If you need to link to another servlet or specify another servlet within the ACTION attribute of a form, you can simply use the servlets name. For example you could use the code to link to another servlet assuming that you have a file in the testing\Web-inf\classes directory called OtherServlet.class (or in your Web-inf\classes directory on the SWAP server)If you have a static HTML page that has a link to a servlet or a form with an ACTION attribute that refers to a servlet, and the HTML page is located in the c:\Program Files\Apache Tomcat 4.0\webapps\testing directory or in your home directory on the SWAP server, use the URL servlet/ServletName to refer to the servlet (eg. ACTION="servlet/ServletName").It is recommended that you use relative references like these in your HREF, SRC and ACTION attributes so that you can easily move your pages from the local machine to the server.

좋은 웹페이지 즐겨찾기