struts로 검색한 결과 :: 시소커뮤니티[SSISO Community]
 
SSISO 카페 SSISO Source SSISO 구직 SSISO 쇼핑몰 SSISO 맛집
추천검색어 : JUnit   Log4j   ajax   spring   struts   struts-config.xml   Synchronized   책정보   Ajax 마스터하기   우측부분

회원가입 I 비밀번호 찾기


SSISO Community검색
SSISO Community메뉴
[카페목록보기]
[블로그등록하기]  
[블로그리스트]  
SSISO Community카페
블로그 카테고리
정치 경제
문화 칼럼
비디오게임 스포츠
핫이슈 TV
포토 온라인게임
PC게임 에뮬게임
라이프 사람들
유머 만화애니
방송 1
1 1
1 1
1 1
1 1
1

struts로 검색한 결과
등록일:2008-03-16 11:44:19
작성자:
제목:Struts 2 Tutorial - 07.폴더구조


본 튜토리얼은 제가 struts 2를 공부할 목적으로 아래의 원문에 링크된 문서를 번역하여 정리한 것입니다.
원문: http://www.roseindia.net/struts/struts2/struts-2-hello-world.shtml



이번 섹션에서는 스트럿츠 2 프레임워크를 기반으로 한 Hello World 어플리케이션을 개발할 것이다. 스트럿츠 2 Hello World 어플리케이션은 스트럿츠 2 프레임워크 기반으로 어플리케이션을 개발하기 위한 첫번째 단계이다. 이제 스트럿츠 2 프레임워크에서 Hello World 어플르키에션을 개발하기 위한 단계별 가이드를 제공한다.

튜토리얼은 폴더 구조 생성, 빌드 툴을 사용한 어플리케이션 빌드를 위한 build.xml 파일 생성과 같은 기본 단계들을 포함한다. Java, JSP, 그리고 환경 설정 파일이 이 어플리케이션을 이해하기 위한 선수지식이다.

프로젝트를 위한 폴더구조생성

1단계
스 트럿츠 2를 다운로드 한 후 struts2-blank-2.0.11.war파일(만약 당신이 최신버전의 스트럿츠2를 사용한다면 이름은 바뀔것이다.)을 톰캣의 webapps 폴더로 복사한다. struts2-blank-2.0.6.war을 struts2tutorial로 이름을 변경한다. 그리고 톰캣 webapps 폴더에서 압축으르 해제한다. 이제 톰캣을 시작한다. 그리고 웹브라우저를 실행하여 주소창에 http://localhost:8080/struts2tutorial을 입력한다. 이제 브라우저는 아래와 같은 것을 보여줄 것이다.
http://localhost:8080/<font style='background-color: rgb(51, 51, 51);' color='#ffff00' size='4'>struts</font>2tutorial

http://localhost:8080/struts2tutorial 실행화면


스트럿츠 2 빈 어플리케이션을 성공적으로 설치한 것을 축하한다.

2단계
이 제 struts2tutorial\WEB-INF\src과 struts2tutorial\WEB-INF\classes 폴더에 있는 파일들을 지운다. 왜냐하면 이 파일들은 스트럿츠 2 빈 어플리케이션이 생성한 파일들이고 필요없기 때문이다.

3단계
struts2tutorial\WEB-INF\src에 build.xml을 생성하고 아래의 내용을 복사해서 붙여넣는다.
<project name="struts 2 Tutorial" basedir="../" default="all">
<!-- Project settings -->
<property name="project.title" value="RoseIndia struts 2 Tutorials"/>
<property name="project.jar.file" value="struts2tutorial.jar"/>

<path id="class.path">

<fileset dir="lib">

<include name="**/*.jar"/>

</fileset>

<fileset dir="libext">

<include name="**/*.jar"/>

</fileset>

</path>

<!-- Classpath for Project -->

<path id="compile.classpath">

<pathelement path ="lib/commons-beanutils.jar"/>

<pathelement path ="lib/commons-digester.jar"/>

<pathelement path ="lib/struts.jar"/>

<pathelement path ="libext/servlet-api.jar"/>

<pathelement path ="libext/catalina-ant.jar"/>

<pathelement path ="classes"/>

<pathelement path ="${classpath}"/>

</path>

<!-- Check timestamp on files -->

<target name="prepare">

<tstamp/>
<copy
file="src/struts.xml"
todir="src/classes"/>


</target>
<!-- Copy any resource or configuration files -->

<target name="resources">

<copy todir="src/classes" includeEmptyDirs="no">

<fileset dir="src/java">

<patternset>

<include name="**/*.conf"/>

<include name="**/*.properties"/>

<include name="**/*.xml"/>

</patternset>

</fileset>

</copy>

</target>

<!-- Normal build of application -->

<target name="compile" depends="prepare,resources">

<javac srcdir="src" destdir="src/classes"
debug="true" debuglevel="lines,vars,source">

<classpath refid="class.path"/>

</javac>

<jar

jarfile="lib/${project.jar.file}"

basedir="src/classes"/>

</target>
<!-- Remove classes directory for clean build -->

<target name="clean"

description="Prepare for clean build">

<delete dir="classes"/>

<mkdir dir="classes"/>

</target>

<!-- Build Javadoc documentation -->

<target name="javadoc"

description="Generate JavaDoc API docs">

<delete dir="./doc/api"/>

<mkdir dir="./doc/api"/>

<javadoc sourcepath="./src/java"

destdir="./doc/api"

classpath="${servlet.jar}:${jdbc20ext.jar}"

packagenames="*"

author="true"

private="true"

version="true"

windowtitle="${project.title} API Documentation"

doctitle="&lt;h1&gt;${project.title}
Documentation (Version ${project.version})&lt;/h1&gt;"

bottom="Copyright &#169; 2002">

<classpath refid="compile.classpath"/>

</javadoc>

</target>

<!-- Build entire project -->

<target name="project" depends="clean,prepare,compile"/>

<!-- Create binary distribution -->

<target name="dist"

description="Create binary distribution">

<mkdir

dir="${distpath.project}"/>

<jar

jarfile="${distpath.project}/${project.distname}.jar"

basedir="./classes"/>

<copy

file="${distpath.project}/${project.distname}.jar"

todir="${distpath.project}"/>



<war

basedir="../"

warfile="${distpath.project}/${project.distname}.war"

webxml="web.xml">

<exclude name="${distpath.project}/${project.distname}.war"/>

</war>

</target>


<!-- Build project and create distribution-->

<target name="all" depends="project"/>

</project>

4단계
struts2tutorial\WEB-INF\ 폴더에 libext 폴더를 생성한 후 최신의 서블릿 API jar (우리의 경우에는 여기)을 복사한 후 이곳에 둔다. 이 라이브러리 파일은 어플리케이션에서 서블릿을 컴파일하기 위해 사용될 것이다.

5단계
이 제 struts2tutorial\WEB-INF\src 폴더 아래에 java와 classes 폴더를 생성한다. struts2tutorial\WEB-INF\src\java 폴더는 모든 자바 소스파일이 위치하며 struts2tutorial\WEB-INF\src\classes 폴더는 컴파일된 자바 파일을 저장하기 위해서 ant 빌드툴이 사용하게 될 것이다.

이제 스트럿츠 2 Hello World 어플리케이션을 위한 폴더 구조와 ant 빌드파일이 성공적으로 생성되었다.
다음 섹션에서 JSP, Java 파일, 환경설정 파일을 생성할 것이다. 그리고 스트럿츠 2 Hello World 어플리케이션을 테스트하게 된다.

출처 : http://jedison.tistory.com/66