반응형

JSP - 현재 페이지 경로,URL,URI,Path,Domain 추출

 

Context : <%= request.getContextPath() %>
URL : <%= request.getRequestURL() %>
URI : <%= request.getRequestURI() %>
Path : <%= request.getServletPath() %>
Domain : <%=request.getRequestURL().toString().replace(request.getRequestURI(),"") %>

 

 

 

반응형
반응형

메이븐(MAVEN) 파헤치기

 

반응형
반응형

eGov Framework - Eclipse install list

 

Eclipse MARS.2
- install New Software 로 쭉 설치
- SpringCore : https://download.springsource.com/release/tools/update/e4.4/Core/ Spring IDE -> Spring IDE Core

Spring Core_e4.4 - https://download.springsource.com/release/TOOLS/update/e4.4/

- UML2 Extension 5.1.2 : http://download.eclipse.org/releases/mars/ Modeling > UML2 Extender SDK

- Subversive SVN Connector 6.0.1 : http://download.eclipse.org/releases/mars/ Collaboration -> Subversive SVN Team Provider(3.0.4)
http://community.polarion.com/projects/subversive/download/eclipse/5.0/mars-site/
Subversive SVN Connectors -> Subversive SVN Connectors(5.0.3) 설치
SVNKit 1.8.12 Implementation(5.0.3) 설치

- eGovFrame3.6.0 : http://maven.egovframe.kr:8080/update_3.6/ 전부 설치

- JUnit 4.12 (선택) : 


- MyBatipse 1.0.23 (선택) : http://dl.bintray.com/harawata/eclipse
http://dl.bintray.com/harawata/eclipse/mybatipse/
MyBatipse -> MyBatipse 설치

반응형
반응형

JSP, Servlet, Spring으로 웹 제작시 가장 필요한 기본중에 기본인 톰캣 환경 구성은 필수!!!


1. 자바 버전 확인

터미널 창에서 java -version을 쳐본다.
혹은 왼쪽 상단의 시스템환경설정에서 자바를 찾아서 클릭한 후 '정보'를 누르면 자바 번전을 확인 할 수 있다.


2.아파치 톰캣(Tomcat)을 다운 받는다.

http://tomcat.apache.org/


다운로드에서 tomcat7.0 / Tomcat9.0 등에서 원하는 버전을 골라서 tar.gz 다운 한다.

Tomcat 7 버전을 다운받았다.


3. 다운로드 폴더에 받아진 톰캣 압축파일을 풀고 이름을 알기 쉽게 'tomcat7'로 바꿔준다.
 그리고 이 폴더를 바탕화면으로 옮겨준다.
 터미널을 켜고 

$>sudo mv ~/Desktop/tomcat7 /usr/local


4. 새로 만든 톰캣 폴더를 언제든지 업데이트 하여도 변경하지 않고 간편하게 쓸 수 있게 하도록 해준다.
심볼릭 링크를 걸어준다.
$>sudo ln -s /usr/local/tomcat7 /Library/Tomcat


5. 내 계정이 폴더를 사용할 수 있도록 권한을 수정해 준다.

$>sudo chwon -R  /Library/Tomcat


6. 쉘을 실행할 수 있도록 권한을 설정해 준다.

$>sudo chmod +x /Library/Tomcat/bin/*.sh



6.쉘을 통해 톰캣을 시작, 중지해 본다.

$>sudo /Library/Tomcat/bin/startup.sh
$>sudo /Library/Tomcat/bin/shutdown.sh




이클립스 설정 과정

1.이클리스 Java EE를 열어보면 하단에 Markers/Properties/Servers/ ... 이 있는 것을 확인 할 수 있다.
그중에 Servers 탭을 열어본다.
그럼 파란 글씨로 No servers are available. Click this link to create a new server. 라는 글씨를 볼 수 있다.
이 파란 링크를 클릭해 준다.

2.맨위 폴더에 Apache 폴더를 열어보면 Tomcat v8.0 Server(우리가 설치한 톰캣이 8.x버전이므로)가 있는데
이를 클릭하고 Next로 넘어간다.

3.Name : ApacheTomcat v8.0
Tomcat installation directory : /usr/local/Tomcat8 으로 옆에 Browse... 을 눌러 설정해준다.
JRE : Java SE 8 [1.8.xxx] 로 설정해준다.

4.위의 과정이 완료되면 아무것도 없던 왼쪽 사이드에 Servers 라고 폴더가 생겼을 것이다.
그리고 밑에 Servers 탭을 보면 Tomcat v8.0 Server at localhost [Stopped, Republish]
아직 서버가 시작되지 않은 상태이다.

5.맨 오른쪽에 파란색 화살표를 눌러주면 서버가 시작된다.
그리고 다시 빨간네모를 눌러주면 서버가 멈춘다.

 

출처 :  https://joonyon.tistory.com/15?category=720949

 

아파치 톰캣(Tomcat) 설치/설정 및 이클립스 설정 // 맥에서(for mac)

JSP, Servlet, Spring으로 웹 제작시 가장 필요한 기본중에 기본인 톰캣 환경 구성은 필수!!! 1. 자바 버전 확인 터미널 창에서 java -version을 쳐본다. 혹은 왼쪽 상단의 시스템환경설정에서 자바를 찾아서 클릭..

joonyon.tistory.com

 

반응형
반응형

사용중인 프레임워크 버전이 3.1

그럼 3.1~ 3.5 버전까지 커버된다고 해서 정보권고안에 Eclipse Luna로 설치해보자. 

 

[[egovframework:dev2:install_guide]]

 

egovframework:dev2:install_guide [eGovFrame]

전자정부 개발자 개발환경은 기본적으로 Windows 32 Bit 기반으로 제공되나 이 이외의 환경에서도 사용 가능하다. Windows 32 Bit 이외의 환경에서 개발환경을 사용할 필요가 있을 경우 본 가이드를 참고하도록 한다. 개발환경을 개별적으로 구성해야 할 필요가 있을 경우 환경에 맞는 eclipse를 다운로드 받아 다음의 순서에 맞게 설치하도록 한다. 설치 소프트웨어 간 dependency 정보가 있으므로 반드시 아래의 순서를 따르도록 한다. *

www.egovframe.go.kr

  • Eclipse Luna(4.4) Packages 이용 시 설치가이드

소프트웨어 버전 자동설치/업데이트주소 필수여부
Eclipse 4.4 http://www.eclipse.org/downloads/packages/release/luna/sr2 → Eclipse IDE for Java EE Developers 다운로드 필수
Spring Core 3.7.0 http://dist.springsource.com/release/TOOLS/update/e4.4/ → Core / Spring IDE → Spring IDE Core 필수
UML2 Extension 5.0.2 http://download.eclipse.org/releases/luna/ → Modeling → UML2 Extender SDK 필수
Subversive SVN Connector 2.0.4 http://download.eclipse.org/releases/luna/ → Collaboration → Subversive SVN Team Provider 설치 
http://community.polarion.com/projects/subversive/download/eclipse/4.0/update-site/ → Subversive SVN Connectors → Subversive SVN Connectors 설치, SVNKit 1.8.7 Implementation 설치
필수
eGovFrame 3.5.1 http://maven.egovframe.kr:8080/update/에서 필요 기능 설치 필수
JUnit 4.11 Eclipse에 JUnit이 내장되어 있으므로 별도 설치 필요 없음 필수
MyBatipse 1.0.13 http://dl.bintray.com/harawata/eclipse → MyBatipse → MyBatipse 선택
PMD 4.0.7 https://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/ → PMD for Eclipse 4 → PMD Plug-in 설치 선택
FindBugs 3.0.1 http://findbugs.cs.umd.edu/eclipse 선택
Properties Editor 6.0.4 http://propedit.sourceforge.jp/eclipse/updates/ → PropertiesEditor 설치 선택
EclEmma 2.3.2 http://update.eclemma.org/ → EcliEmma → EclEmma Java Code Coverage 선택
Developer Tools 23.0.7 http://rgladwell.github.com/m2e-android/updates/ → Developper Tools → 모두설치 안드로이드 개발 필수
Android Connector for M2E 1.4.0 http://rgladwell.github.com/m2e-android/updates → Android for Maven Eclipse → Android for Maven Eclipse 안드로이드 개발 필수

 

자바 설치 : 7 버전.

https://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html

 

Java Archive Downloads - Java SE 7

 

www.oracle.com

@다운로드 해서 .dmg 파일 설치 후 버전 확인

 

    * JDK 설치 위치 : /Library/Java/JavaVirtualMachines
        * JDK 설치위치에 jdk1.7.0_80.jdk 이 생성되어 있으면 정상설치 완료 된 것임
    * Java 버전 확인 : java -version 

@JAVA 삭제 할 경우

    * JDK 설치위치 
        * /Library/Java/JavaVirtualMachines/ 하위
            /Library/Java/JavaVirtualMachines/jdk<major>.<minor>.<macro[_update]>.jdk
    * 설치되어 있는 JDK 디렉토리 제거 
        * JDK 7u11 예 : rm -rf jdk1.7.0_80.jdk
 

 

1. Eclipse Mars의 Eclipse IDE for java EE Developers 설치하기

Eclipse Mars 다운로드

 

Mars 2 | Eclipse Packages

370 MB 27,329 DOWNLOADS The Modeling package provides tools and runtimes for building model-based applications. You can use it to graphically design domain models, to leverage those models at design time by creating and editing dynamic instances, to collab

www.eclipse.org

Luna, Kepler는 다운받아서 실행해보니 실행이 안되더라. 결국 Mars로 낙점!!!

 

2. 이클립스를 설치 및 실행한 뒤 help -> Install New Software를 클릭한다.

   Download the ADT Plugin

  1. Start Eclipse, then select Help > Install New Software.
  2. Click Add, in the top-right corner.
  3. Click OK. ...
  4. In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
  5. In the next window, you'll see a list of the tools to be downloaded.

3. 다음 플러그인들을 순서대로 추가한 뒤 설치해준다. 
 1) Spring Core 3.7.3 (필수)
    http://dist.springsource.com/release/TOOLS/update/e4.4/
    Core / Spring IDE -> Spring IDE Core

 

2) UML2 Extension 5.1.2 (필수)
    http://download.eclipse.org/releases/mars/
    Modeling -> UML2 Extender SDK

 

3) Subversive SVN Connector 6.0.1 (필수)
    http://download.eclipse.org/releases/mars/
    Collaboration -> Subversive SVN Team Provider(3.0.4)
    http://community.polarion.com/projects/subversive/download/eclipse/5.0/mars-site/
    Subversive SVN Connectors -> Subversive SVN Connectors(5.0.3) 설치
    SVNKit 1.8.12 Implementation(5.0.3) 설치

 

4) eGovFrame 3.6.0 (필수)
    http://maven.egovframe.kr:8080/update_3.6/
    필요한 플러그인 설치(전부 다 설치했음)

 

5) JUnit 4.12 (필수)
    이클립스에 내장되어있어서 별도 설치과정 필요없음

 

6) MyBatipse 1.0.23 (선택)
    http://dl.bintray.com/harawata/eclipse
    MyBatipse -> MyBatipse 설치

 

7) PMD 4.0.11 (선택)
    https://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/
    PMD for Eclipse 4 -> PMD Plug-in 설치

 

8) FindBugs 3.0.1 (선택)
    http://findbugs.cs.umd.edu/eclipse
    FindBugs -> FindBugs Feature 설치

 

9) Properties Editor 6.0.4 (선택)
    http://propedit.sourceforge.jp/eclipse/updates/
    PropertiesEditor 설치

 

10) EclEmma 2.3.3 (선택)
      http://update.eclemma.org/
      EclEmma -> EclEmma Java Code Coverage 설치

 

11) Gradle 1.0.21 (선택)
     http://download.eclipse.org/buildship/updates/e45/releases/1.0
     Buildship:Eclipse Plug-ins for Gradle -> Buildship:Eclipse Plug-ins for Gradle 설치

 

12) Developer Tools 23.0.7 / Android Connector for M2E 1.4.0(안드로이드 개발 필수)
     http://rgladwell.github.com/m2e-android/updates/
     Developer Tools 모두 설치 (Developer Tools)
     Android for Maven Eclipse -> Android for Maven Eclipse 설치 (Android Connector for M2E)


 

 

-----

 

반응형
반응형

Spring MVC Framework with Example

 

https://javabeat.net/introduction-to-spring-mvc-web-framework-web-tier/

 

Spring MVC Framework with Example

This article provides an introduction over the various components that are available in the Spring MVC for the Web Tier with Example and Sample Application

javabeat.net

  1. The Client requests for a Resource in the Web Application.
  2. The Spring Front Controller, which is implemented as a Servlet, will intercept the Request and then will try to find out the appropriate Handler Mappings.
  3. The Handle Mappings is used to map a request from the Client to its Controller object by browsing over the various Controllers defined in the Configuration file.
  4. With the help of Handler Adapters, the Dispatcher Servlet will dispatch the Request to the Controller.
  5. The Controller processes the Client Request and returns the Model and the View in the form of ModelAndView object back to the Front Controller.
  6. The Front Controller then tries to resolve the actual View (which may be Jsp, Velocity or Free marker) by consulting the View Resolver object.
  7. Then the selected View is rendered back to the Client.

Let us look into the various Core Components that make up the Spring Web Tier. Following are the components covered in the next subsequent sections.

 

 

반응형
반응형

유용한 단축키 모음

 

Ctrl + Shift + R : 리소스 찾기


◈ Java Editor 단축키

Ctrl + Shift + M : 특정 클래스 Import

Ctrl + Shift + O : 자동으로 Import

 

Ctrl + L : 특정 줄 번호로 이동

Ctrl + 마우스커서(혹은 F3) : 클래스나 메소드 혹은 멤버를 상세 검색

ALT + Left , ALT + Right : 이전, 이후 작업 화면

Ctrl + Shift + G : 특정 메소드나 필드를 Reference하고 있는 곳을 검색

Ctrl + , or  : 다음 annotation(에러, 워닝, 북마크 가능)으로 점프

Ctrl + T : hierarchy 팝업 창 띄우기(인터페이스 구현 클래스간 이동 시 편리)

F4 : hierachy view 퍼스펙티브 생성

Ctrl + O : 메소드나 필드 이동하기

Ctrl + Shift + Down : 클래스 내에서 다음 멤버로 이동

F2 : 컴파일 에러의 빨간 줄에 커서를 가져다가 이 키를 누르면 에러의 원인에 대한 힌트를 제공

Ctrl + 0 : 클래스 구조를 트리로 보기

Ctrl + Shift + T : 클래스 찾기

Ctrl + Shift + Space : 메소드의 파라미터 목록 보기

(메소드의 괄호 안에 커서를 놓고 이 키를 누르면 파라미터 타입 힌트를 볼 수 있음)

 

Ctrl + K : 찾고자 하는 문자열을 블럭으로 설정한 후 키를 누른다

Ctrl + Shift + K : 역으로 찾고자 하는 문자열을 찾아간다

Ctrl + J : Incremental find 이클립스 하단 상태 표시줄에 Incremental find 라고 표시되어 한 글자자씩 누를 때 마다 코드내의 일치하는 문자열로 이동, 다시 Ctrl + J 를 누르면 그 문자열과 일치 하는 부분을 위/아래 방향키로 탐색이 가능

Ctrl + PageUp , Ctrl + PageDown : Edit 창 좌우 이동 (Edit 창이 여러 개 띄워져 있을 경우 Edit 창간의 이동)

 

Ctrl + Shift + F : 코드 자동 정리

Ctrl + 1 : Quick Fix 에러가 발생했을 경우 Quick Fix를 통해 쉽게 해결이 가능함

Ctrl + Shift + / : 블록 주석(/* */)

Ctrl + Shift + \ : 블록 주석 제거

Ctrl + / : 여러 줄이 한꺼번에 주석 처리됨 (주석 해제하려면 반대로 하면 됨)

Alt + Up(Down) : 위(아래)줄과 바꾸기

Alt + Shift + UP : 커서를 기준으로 토큰단위 블럭지정

Alt + Shift + DOWN : 커서를 기준으로 토큰단위 블럭해제

Alt + Shift + 방향키 : 블록 선택하기

Alt + Shift + R : Refactoring (이름변경) - Refactoing 으로 전체 소스에서 이름변경에 의한 참조 정보를 변경해 준다

Alt + Shift + J : 자동으로 주석 달기 (메소드나 멤버변수에 포커스 두고 실행)

Alt + Shift + Z : Surround With 메뉴 (try / catch 문이나 for , do , while 등을 해당 블록에 감싸주는 메뉴가 나타남)

Ctrl + Space : 입력 보조장치(Content Assistance) 강제 호출 → 입력하는 도중엔 언제라도 강제 호출 가능함

Ctrl + D : 한 줄 삭제

Ctrl + W : 파일 닫기

Ctrl + I : 들여쓰기 자동 수정

Ctrl + Shift + X : 대문자로 변환

Ctrl + Shift + Y : 소문자로 변환

Ctrl + Shift + L : 모든 단축키의 내용을 표시

Ctrl + Shift + B : 현재 커서 라인에 Break point 설정

 

Ctrl + F6 : 창간 전환, UltraEdit 나 Editplus 의 Ctrl + Tab 과 같은 기능

Ctrl + Shift + F4 : 열린 파일 모두 닫기

Ctrl + M : 전체화면 토글

Ctrl + Alt + Up(Down) : 한 줄(블럭) 복사

템플릿 수정 → 환경설정/자바/편집기/템플릿



◈ Window 이동

F10 : 메뉴창을 활성화

Ctrl + F8 : 다음 Perspective로 이동

Ctrl + N : 새로운 파일 및 프로젝트 생성

Ctrl + Shift + Down : Java Editor에서 다음 member로 이동

Ctrl + F7 : 다음 View로 이동

Ctrl + Shift + F7 : 이전 View로 이동

Alt + ← : 이전 작업 화면

Alt + → : 다음 작업 화면

F12 : 컴파일 중 에러 등으로 포커스가 다른 곳으로 갔을 때 Editor 로 커서 이동

Ctrl + 1 : 컴파일 에러가 발생한 곳에서 Ctrl + 1을 누를 경우 컴파일 에러에 대한 해결책을 제시

 

◈ 디버깅 단축키

Ctrl + Shift + B : 현 커서의 위치에 브레이크 포인터 설정/해제

F11 : 디버깅 시작

F8 : 디버깅 계속

F6 : 한 줄씩 실행(Step Over)

F5 : 한 줄씩 실행하되 함수일 경우 그 함수 내부로 들어감(Step Into)

Ctrl + R : 현재 라인까지 실행(Run to Line)

Ctrl + F11 : 이전에 실행되었던 Run 파일 실행

 

◈ 메소드 쉽게 생성하기

Ctrl + Space 하면 템플릿 (환경설정/자바/편집기/템플릿 에서 편집 가능)

클래스의 멤버를 일단 먼저 생성한다

override 메소드를 구현하려면, 소스→메소드대체/구현 에서 해당 메소드를 체크한다

기타 클래스의 멤버가 클래스의 오브젝트라면, 소스→위임메소드 생성에서 메소드를 선택한다

 

◈ Organize import

자바파일을 여러 개 선택한 후 소스→가져오기 체계화 해주면 모두 적용됨

 

◈ 소스 코드 형식 및 공통 주석 설정

환경설정 → 자바 → 코드 스타일 → 코드 포맷터 → 가져오기 → 프로파일.xml

환경설정 → 자바 → 코드 스타일 → 코드 템플릿 → 가져오기 → 템플릿.xml

다수의 자바파일에 프로파일을 적용하려면 패키지 탐색기에서 패키지를 선택한 후 소스 → 형식화를 선택하면 됨

 

◈ 에디터 변환

에디터가 여러 파일을 열어서 작업 중 일 때 Ctrl + F6 키를 누르면 여러 파일명이 나오고 F6키를 계속 누르면 아래로 Ctrl + Shift + F6 키를 누르면 위로 커서가 움직임

Ctrl + F7 : 뷰간 전환

Ctrl + F8 : 퍼스펙티브간 전환

F12 : 에디터로 포커스 위치



출처: https://devnudie.tistory.com/entry/eclipse이클립스-유용한-단축키 [Kasina Story]

반응형

'프로그래밍 > JAVA' 카테고리의 다른 글

MAcOS Pro에 전자정부프레임워크 설치?!  (0) 2019.04.26
JSP Spring workflow  (0) 2019.04.24
JSTL, Function Tag의 이해  (0) 2019.04.23
주석, JSP, JAVA  (0) 2019.04.23
JSTL, Format Tag의 이해  (0) 2019.04.23
반응형

JSTL, Function Tag의 이해

  • Functon 태그는 자주 사용하는 유틸 함수의 기능을 제공한다.
  • <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 선언을 해줘야 사용할 수 있다.

5.1 Function Tag 에서 지원하는 함수들

  • 아래 표는 Function Tag 에서 지원하는 함수들이다.

 

속성 설명
fn:contains(string, sbustring) string이 substring을 포함하면 return True
fn:containsIgnoreCase(string, sbustring) 대소문자 관계없이 string이 substring을 포함하면 return True
fn:endsWith(string, suffix) string이 suffix로 끝나면 return True
fn:escapeXml(string) stting에 XML과 HTML에서 특수문자(<,>,&,',")들이 있으면, XML엔티티 코드로 바꿔준뒤 문자열 반환
fn:indexOf(string, sbustring) string에서 substring이 처음으로 나타나는 인덱스 반환
fn:join(array, separator) array요소들을 separator를 구분자로 하여 연결해서 반환
fn:length(item) item이 배열이나 컬렉션이면 요소의 객수를 문자열이면 문자의 객수를 반환
fn:replace(string, before, after) string내에 있는 before 문자열을 after 문자열로 모두 변경해서 반환
fn:split(string, separator) string내의 문자열 separetor에 따라 나누어서 배열로 구성해서 반환
fn:startsWith(string, prefix) string이 prefix로 시작하면 return True
fn:substring(string, begin, end) string에서 begin인덱스에서 시작해서 end인덱스에 끝나는 부분의 문자열 반환
fn:substringAfter(string, sbustring) string에서 substring이 나타나는 이후의 문자열 반환
fn:substringBefore(string, sbustring) string에서 substring이 나타나는 이전의 문자열 반환
fn:toLowerCase(string) string을 모두 소문자로 바꿔 리턴
fn:toUpperCase(string) string을 모두 대문자로 바꿔 리턴
fn:trim(string) string앞뒤의 공백을 모두 제거하여 반환

 

 

 

출처 : http://wiki.gurubee.net/pages/viewpage.action?pageId=26740270

 

JSTL의 이해 및 실습 - 12.구루비 Dev 스터디 - 개발자, DBA가 함께 만들어가는 구루비 지식창고!

JSTL의 이해 및 실습 Added by 김정식, last edited by 김정식 on 9월 18, 2012  (view change) JSTL의 이해 및 활용 1. JSTL의 이해 http://tomcat.apache.org/taglibs/ JS

wiki.gurubee.net

.....

반응형

'프로그래밍 > JAVA' 카테고리의 다른 글

JSP Spring workflow  (0) 2019.04.24
eclipse(이클립스) 유용한 단축키  (0) 2019.04.23
주석, JSP, JAVA  (0) 2019.04.23
JSTL, Format Tag의 이해  (0) 2019.04.23
JSP 에서 ASP의 response.end 처럼 하기  (0) 2019.04.23

+ Recent posts