'Works/My Project'에 해당되는 글 6건
- 2009.01.19 [스크랩]Spring MVC - 구성 요소 및 처리 흐름
- 2009.01.14 Writing JavaScript with DWR 2
- 2008.11.18 OZ Report
- 2008.11.18 OZ Report Designer
- 2008.11.05 Project Terms
- 2008.08.07 [Spring2] 자바지기 Spring 프레임워크 강의 - Spring Framework - Confluence 1
원글 : http://blog.naver.com/jiruchi/10033260451
스프링 MVC 의 구성 요소
DispatcherServlet : 클라이언트의 요청을 전달 받아, 컨트롤러에게 클라이언트의 요청을 전달하고 리턴한 값을 View 에 전달하여 응답을 생성한다.
HandlerMapping : 클라이언트의 요청 URL 을 어떤 컨트롤러가 처리할지 결정
Controller : 클라이언트의 요청을 처리후 그 결과를 DispatcherServlet에 알려준다.
ModelAndView : 컨트롤러가 처리한 결과 정보 및 뷰 선택에 필요한 정보를 담는다.
ViewResolver : 컨트롤러의 처리 결과를 생성할 뷰를 결정한다.
View : 컨트롤러의 처리 결과 화면을 생성한다.
스프링 MVC 의 처리 흐름
1. 클라이언트 요청이 DispatcherService 에 전달
2. HanderMapping 에 클라이언트 요청을 처리할 컨트롤러 객체를 구함
3. 컨트롤러 객체의 handleRequest() 메서드를 호출하여 요청을 처리
4-5. 컨트롤러의 handleRequest() 메서드는 처리 결과 정보를 담은 ModelAndView 를 리턴
6-7. ViewResolver 응답 결과를 생성할 뷰 객체를 구함
8-9. View 는 클라이언트에 전송할 응답을 생성
[출처] Spring MVC - 구성 요소 및 처리 흐름|작성자 jiruchi
'Works > My Project' 카테고리의 다른 글
Writing JavaScript with DWR (2) | 2009.01.14 |
---|---|
OZ Report (0) | 2008.11.18 |
OZ Report Designer (0) | 2008.11.18 |
DWR 을 처음한 나에게 제일 도움이 되는 글이다.. ^^
callback 함수를 처음 써본 난 이 한줄이 왜 그리 어려운건지..
이렇게 쭉~~~ 늘여진 걸 순서대로 줄이니 그야말로 이해가 쉽네..
출처 : http://directwebremoting.org/dwr/browser/intro
Writing JavaScript with DWR
DWR generates Javascript code that is similar to the Java code that exported using dwr.xml.
The biggest challenge in creating a remote interface to match some Java code across Ajax is the (usually) asynchronous nature of Ajax, compared to the synchronous nature of a normal Java call.
DWR solves this problem by introducing a callback function that is called when the data is returned from the server.
There are 2 recommended ways to make a call using DWR. Either using by appending a callback function to the parameter list or by appending a call meta data object.
It is also possible to put the callback function at the start of the parameter list, however this option is not advised because there are some issues when dealing with automatic http objects (see "Alternative Method"). This method mostly remains for backwards compatibility.
Simple Callback Functions
Suppose we have a Java method that looks like this:
public class Remote { public String getData(int index) { ... } }
We can use this from Javascript as follows:
<script type="text/javascript" src="[WEBAPP]/dwr/interface/Remote.js"> </script> <script type="text/javascript" src="[WEBAPP]/dwr/engine.js"> </script> ... function handleGetData(str) { alert(str); } Remote.getData(42, handleGetData);
'42' is just the parameter to the getData()
Java function - see above.
Alternatively you can use the all-in-one-line version:
Remote.getData(42, function(str) { alert(str); });
Call Meta-Data Objects
The alternative syntax is to make use of a call meta-data object that specifies the callback function and (optionally) other options. The example above would become:
Remote.getData(42, { callback:function(str) { alert(str); } });
This method has some advantages: Depending on your style it may be easier to read, but more importantly it allows you to specify extra call options.
Timeouts and Handling Errors
In addition to the callback meta data you can also specify a timeout and an errorHandler. For example:
Remote.getData(42, { callback:function(str) { alert(str); }, timeout:5000, errorHandler:function(message) { alert("Oops: " + message); } });
Finding the callback method
There are some instances when it might not be tricky to distinguish between the various callback placement options. (Remember that Javascript does not support overloaded functions). For example:
Remote.method({ timeout:3 }, { errorHandler:somefunc });
One of the 2 parameters is a bean parameter and the other is a call meta-data object but we have no way of telling which. In a cross-browser world we have to assume that null == undefined. So currently, the rules are:
- If there is a function first or last then this is the callback function, there is no call meta-data object and the other parameters are the Java args.
- Otherwise, if the last param is an object with a callback member that is a function then this is call meta-data the other params are Java args.
- Otherwise, if the first parameter is null we assume that there is no callback function and the remaining params are Java args. HOWEVER we check to see that the last param is not null and give a warning if it is.
- Finally if the last param is null, then there is no callback function.
- Otherwise, this is a badly formatted request - signal an error.
Creating Javascript objects to match Java objects
Suppose you have an exposed Java method like this:
public class Remote { public void setPerson(Person p) { this.person = p; } }
And Person
looks like this:
public Person { private String name; private int age; private Date[] appointments; // getters and setters ... }
Then you can call this from Javascript like this:
var p = { name:"Fred Bloggs", age:42, appointments:[ new Date(), new Date("1 Jan 2008") ] }; Remote.setPerson(p);
Any fields missing from the Javascript representation will be left unset in the Java version.
Since the setter returned 'void' we did not need to use a callback and could just leave it out. If you want to be notified of the completion of a server-side method that returns void then you can include a callback method. Obviously DWR will not pass any data to it.
'Works > My Project' 카테고리의 다른 글
[스크랩]Spring MVC - 구성 요소 및 처리 흐름 (0) | 2009.01.19 |
---|---|
OZ Report (0) | 2008.11.18 |
OZ Report Designer (0) | 2008.11.18 |
oza를 로컬에서 실행하고 ozr을 호출하다가 odi를 못찾는다는 에러메시지가 나면
oza에 ozr이 포함하고 있는 odi를 포함하고 있는지 확인하도록 한다.
'Works > My Project' 카테고리의 다른 글
Writing JavaScript with DWR (2) | 2009.01.14 |
---|---|
OZ Report Designer (0) | 2008.11.18 |
Project Terms (0) | 2008.11.05 |
처음에 JVM 에러가 나면
OZ Report Designer
C:\Program Files\Forcs\OZ XStudio\OZ Report Designer 3.5[해당OZ 어플]\config\launch.cfg
에 JRE_PATH 를 변경해 주도록 한다.
'Works > My Project' 카테고리의 다른 글
OZ Report (0) | 2008.11.18 |
---|---|
Project Terms (0) | 2008.11.05 |
[Spring2] 자바지기 Spring 프레임워크 강의 - Spring Framework - Confluence (1) | 2008.08.07 |
CMS : 기지국 장비
RCS : 광중계기 감시장치
'Works > My Project' 카테고리의 다른 글
OZ Report (0) | 2008.11.18 |
---|---|
OZ Report Designer (0) | 2008.11.18 |
[Spring2] 자바지기 Spring 프레임워크 강의 - Spring Framework - Confluence (1) | 2008.08.07 |
[Spring2] 자바지기 Spring 프레임워크 강의 - Spring Framework - Confluence
![](https://tistory1.daumcdn.net/tistory/207148/skin/images/bg_clear.gif)
- 스키마 기반의 Spring 프레임워크 기본 설정파일
- [Spring 2.0의 Bean Scope]
- Spring 2.0에서 새롭게 추가된 Namespaces
- [나만의 XML Namespace 정의하기]
- [Spring 2.0의 AOP]
- [Spring 2.0에서 훨씬 쉬워진 Transaction 설정]
- Spring JDBC - NamedParameterJdbcTemplate, SimpleJdbcTemplate
- [Message Driven POJO]
- [Spring MVC의 Form Tag 지원]
- [Spring MVC의 Convetion over Configuration]
- [동적 스크립트 언어 지원]
기본 Spring 프레임워크 API 사용예제
- 간단한 Hello World를 출력하는 예제 : Hello World를 출력하는 예제를 통하여 기존의 개발 방식과 Spring을 이용했을 때의 개발 방식의 차이점을 이해한다.
- 다양한 Type의 인자를 Injection하는 예제 : Spring 설정파일에서는 다양한 Type의 인자들을 전달하는 것이 가능하다.
- Bean Naming을 이해할 수 있는 예제 : Bean Naming으로 여러가지 방식을 지원한다.
- Singleton과 Non-Singleton을 설정하기 위한 예제 : Spring은 Default로 Singleton을 사용한다. 그러나 Singleton 인스턴스가 필요하지 않을 때가 있다.
- 각 Bean들을 Auto-Wiring으로 엮는 예제 : Spring에서는 Auto-Wiring으로 각각의 Bean들의 Dependency를 자동적으로 연결하는 것이 가능하다.
- Bean 상속 : Spring에서도 Bean의 상속을 통해서 중복을 방지하는 것이 가능하다.
Advanced Spring 프레임워크 API 사용예제
- Bean의 LifeCycle을 이해하기 위한 예제 : Spring은 POJO Bean의 LifeCycle을 Control하는 것이 가능하다.
- 우리가 만든 Bean들이 Spring 프레임워크를 인식하도록 만들기 : Spring 프레임워크에서는 우리가 만든 POJO Bean들이 Spring 프레임워크의 내부를 이해하고 사용할 수 있도록 하는 것이 가능하다. 그 같은 API에 대하여 살펴본다.
- Method Injection : Spring 프레임워크에서 새롭게 제공하는 Dependency Injection의 한 종류이다.
- ApplicationContext에 의하여 지원되는 간단한 Event Mechanism : ApplicationContext가 지원하고 있는 Event처리 메커니즘에 대하여 살펴본다.
- MessageSource를 사용하여 국제화 기능 지원 : ApplicationContext는 MessageSource를 사용하는 것이 가능하다. 이 같은 기능을 이용하여 애플리케이션에 국제화 기능을 지원하는 과정에 대하여 살펴본다.
- 자바빈 Property Editors : Spring에서는 이미 다양한 Property Editor를 지원하고 있다. Spring에서 지원하는 Property Editor에 대하여 살펴본다. 그리고 우리들이 원하는 형태로 Property Editor를 생성하는 방법에 대해서도 살펴보도록 한다.
- FactoryBean을 사용해야하는 경우와 사용예제 : Spring은 일관된 Bean의 관리와 적용을 위하여 FactoryBean을 이용하고 있다. FactoryBean이 왜 필요하며, 사용방법에 대하여 살펴보도록 한다.
Spring 프레임워크 개발 전략
- Spring의 Bean Definition 설정 파일 관리 전략 : Spring의 설정 파일은 작은 애플리케이션의 경우 단 하나만으로 모든 Bean을 관리할 수 있다. 그러나 중/대규모의 애플리케이션일 경우 하나만으로 관리하기에는 유지보수가 힘들어 질 수 박에 없다. 이 같은 한계를 극복할 수 있는 방법에 대하여 살펴본다.
- Spring 프레임워크에서의 테스트 전략 : Spring 프레임워크를 이용할 경우 큰 장점중의 하나가 테스트의 용이성이다. Spring 프레임워크 기반하에서의 테스트 전략에 대하여 살펴본다.
기본적인 Spring AOP 기능
- Spring AOP에서 제공하는 Advice들에 관한 예제 : Spring AOP는 여러 종류의 Advice를 제공하고 있다. 각각의 예제를 통하여 이 같은 기능을 어떻게 활용할 수 있는지 다룬다.
- Spring AOP에서 제공하는 Advisors와 Pointcuts : AOP를 적용하기 위해서는 Pointcut 개념을 이해하고 있어야 한다. Spring AOP에서는 Pointcut을 어떻게 생성하고 설정하는지에 대하여 살펴본다.
- JDK Dynamic Proxy와 CGLIB Proxy에 대한 이해 : Spring AOP는 JDK Dynamic Proxy와 CGLIB Proxy 두가지를 이용하여 AOP를 가능하도록 지원하고 있다. 이 두가지 Proxy 방법에 대하여 살펴본다.
Advanced Spring AOP 기능
- Introduction 시작하기 : AOP의 개념중 Introduction이라는 개념이 있다. Introduction은 이미 구현되어 있는 구현체에 완전히 새로운 기능을 추가하는 것이 가능하다. Introduction 기능을 이용하여 이 같은 작업이 어떻게 가능한지에 대하여 살펴본다.
- AOP를 Bean Definition에서 선언적으로 사용하기 : ProxyFactory를 이용하여 AOP 기능을 프로그램에서 사용하는 것이 가능하다. 그러나 Spring 프레임워크에서는 모든 Bean Definition을 선언적으로 사용하듯이 AOP 적용 또한 선언적으로 하고 싶다. Spring 프레임워크에서는 이 방법을 어떻게 해결하고 있는지 살펴본다.
- Automatic Proxying 사용 예제 : Bean Definition을 설정할 때마다 특정 AOP를 추가하는 것은 여간 번거로운 작업이 아니다. Automatic Proxying을 통하여 하나의 Aspect가 특정 패턴을 가지는 모든 Bean에 적용되는 방법에 대한 예제를 살펴본다.
- Spring 프레임워크와 AspectJ의 통합 : Spring AOP가 AOP의 모든 기능을 제공하는 것이 아니다. Spring AOP가 지원하지 못하는 기능들을 AspectJ가 지원할 수 있는 경우가 대부분이다. 따라서 Spring 프레임워크와 AspectJ를 통합할 수 있다면 상당히 유용할 것이다.
Spring 프레임워크 개발 전략
- AOP를 사용하기 위한 프로젝트 개발 전략 : AOP 개념을 프로젝트에 적용하기 위해서는 기존의 프로젝트 개발 방법과 달라지는 부분이 있다. AOP를 적용할 경우 프로젝트 초반에 수립해야 될 부분과 그렇지 않아도 되는 부분등에 대하여 다룬다.
- 다양한 AOP 툴중에서 적절한 툴을 선택하기 위한 전략 : 현재 자바 진영에서 사용할 수 있는 프레임워크는 Spring AOP, JBoss AOP, AspectJ 등이 일반적으로 사용되고 있다. 이 프레임워크 어떠한 프레임워크를 사용할 것인지를 선택하는 것이 또한 중요하다. 이와 같은 프레임워크의 선정 방법에 대하여 다룬다.
Transaction : Transaction에 대한 기본적인 개념과 Spring에서 지원하는 Transaction에 대하여 살펴본다.
Transaction은 어느 곳에서 처리되어야 할까? : Transaction은 어느 레이어에서 처리해야 할까? 지금까지의 개발 방식과 Spring을 이용할 경우 어떻게 해결할 수 있는지에 대하여 살펴본다.
Basic
- 모델 1과 모델2의 차이점 : 모델1과 모델2의 차이점에 대하여 비교분석한다.
- Spring MVC에서 클라이언트 요청의 처리 과정 : Spring MVC는 클라이언트에서의 요청을 바로 JSP가 처리하는 것이 아니라 DispatcherServlet이라는 메인 Servlet에서 제어하게 된다. 이 Controller에 의하여 처리되는 과정을 살펴본다.
- HandlerMapping
- Controller 구조 및 역할 : Spring 프레임워크는 다양한 요청에 대한 처리를 위하여 여러가지 종류의 Controller를 제공하고 있다. 각 Controller의 종류 및 사용 방법을 살펴보도록 한다.
- SimpleFormController의 Workflow : SimpleFormController는 Spring 프레임워크에서 한 페이지의 Form 페이지를 처리하기 위하여 유용하게 사용할 수 있는 Controller이다. SimpleFormController가 처리되는 Workflow에 대하여 알아본다.
- ViewResolver
- View
참고문서
- 프레임워크
- Model1, Model2, Struts 개발 방식의 비교 분석
: 모델1과 모델2 개발 방식의 차이점에 대하여 잘 설명하고 있다.
- 스트럿츠 프레임워크 워크북 1장 3강 - 사용자 관리 프로젝트
, 스트럿츠 프레임워크 워크북 1장 4강 - 사용자 관리 프로젝트
, 스트럿츠 프레임워크 워크북 1장 5강 - 사용자 관리 프로젝트
: 실전 예제를 통하여 모델1과 모델의 차이점을 비교분석하고 있다. 또한 각각의 장단점에 대하여 파악할 수 있다.
- Model1, Model2, Struts 개발 방식의 비교 분석
'Works > My Project' 카테고리의 다른 글
OZ Report (0) | 2008.11.18 |
---|---|
OZ Report Designer (0) | 2008.11.18 |
Project Terms (0) | 2008.11.05 |