달력

3

« 2024/3 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
.. .. ..

 

[펌] : http://yunsunghan.tistory.com/562

Spring에서 DWR 사용하기(모든 설정을 annotation 하기)

내가 이글(http://yunsunghan.tistory.com/137)를 쓴지가 벌써 3,4년 전이였는데 아직도 그설정 그대로 사용하고 있는걸 보니, 이젠 뭔가 바뀌어 있지 않을까 하고 찾아 봤다. 별고 바뀐건 없지만, 한가지 눈에 띄는게 있다. @DataTransferObject 인데, 그땐 발견하지 못한건지, 적용하지 못하고 있음을 과거글에서 찾아 볼수있다. 모델 매핑은 XML에서 하고 있으니 말이다. 

경기도 시흥에 1박으로 놀려놨다가 아침에 다른(addon)것 찾아보다 발견하여 기록해본다. @DataTransferObject를 적용하는 방법은 여기(http://www.butterdev.com/dwr/2010/10/dwr-spring-and-annotations/)에 잘 나와 있다. 핵심은 아래 코드를 참조하자. 

[XML설정]

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd">
  
   <dwr:configuration />   
   <dwr:annotation-scan base-package="org.uk.ltd.dwr.dev" scanDataTransferObject="true" scanRemoteProxy="true"/>   
</beans>

 



[소스코드-Bean]

@DataTransferObject
public class Address {
private String street;
...

 


[소스코드-Biz]

@RemoteProxy(name="dwrService")
public class DWRService {
public DWRService() { }
@RemoteMethod
public Address getAddress() throws Exception {
Address address = new Address();
address.setStreet("2245 NW Overlook Drive");
address.setCity("Portland");
address.setState("Oregon");
return address;
}
     ... 

'I.lib() > I.lib(Web)' 카테고리의 다른 글

Spring 과 DWR 적용 Sample  (0) 2014.01.10
web.xml 태그 설정  (0) 2011.05.03
.
:
Posted by .07274.