[ Flex ] Flex 3.0 에서 Blazeds 사용하기
[조만간 다시 정리 해야겠다.. 내가 적어 놓고도 잘 이해가 안될때 가있는 설정화면 들... 쩝]
문서 최종업데이트 2009.06.10
##########################################################
[설치]
##########################################################
1. blazeds.war을 c:\Tomcat6\webapps\ 에 복사한다.(그럼 자동 압축이 풀림)
2. Tomcat이 자동으로 blazeds.war 압축을 푼다.
3. blazeds\WEB-INF\flex\remoting-config.xml 내용중
<destination id="ListWaterDayRO"> <!-- Flex에서 사용할 RemoteObject명 -->
<properties>
<source>com.watercom.DayWaterList</source> <!-- 경로~Class명 -->
</properties>
<channels>
<channel ref="my-amf"/>
</channels>
</destination>
위 부분을 추가한다.
##########################################################
[환경설정]
##########################################################
4. flex 기존 Project 수정
Project Properties 에서 Compiller탭에 다음과 같이 수정한다.
-services "C:\Tomcat6\webapps\blazeds\WEB-INF\flex\services-config.xml" -locale en_US
예) 아래 화면예와 위 설정 값은 다를수 있습니다. Blazeds가 설정된 폴더를 입력하면됩니다
5 .flexProperties 화일을 다음과 같이 수정한다.
<flexProperties flexServerType="2" serverContextRoot="/blazeds" serverRoot="C:/Tomcat6/webapps/blazeds" serverRootURL="http://localhost:8080/blazeds" toolCompile="true" useServerFlexSDK="false" version="1"/>
6. 설정하면 자동으로 아래와 같이 변경됨
예) 플렉스를 종료했다 다시 실행 하셔야 합니다.
##########################################################
[사용예]
자바클래스 소스
컴파일후 클래스를 /blazeds/WEB-INF/classes/ 에 복사한다
##########################################################
DayWaterList.java
package com.watercom; import java.util.*; public class DayWaterList { public List read(int a) { ArrayList al = new ArrayList(); al.add( new Member("2008-06-19 13:34:39","30","20","10") ); al.add( new Member("2008-06-20 13:34:39","31","22","11") ); al.add( new Member("2008-06-21 13:34:39","32","23","12") ); al.add( new Member("2008-06-22 13:34:39","33","24","13") ); al.add( new Member("2008-06-23 13:34:39","34","25","14") ); al.add( new Member("2008-06-24 13:34:39","35","26","15") ); al.add( new Member("2008-06-25 13:34:39","36","27","16") ); al.add( new Member("2008-06-26 13:34:39","37","28","17") ); al.add( new Member("2008-06-27 13:34:39","38","29","18") ); al.add( new Member("2008-06-28 13:34:39","39","30","19") ); return al; } };
Member.java
package com.watercom; import java.io.Serializable; public class Member implements Serializable { public String adate; public String s_us; public String e_us; public String gang; public Member(String adate, String s_us, String e_us, String gang) { this.adate = adate; this.s_us = s_us; this.e_us = e_us; this.gang = gang; } }
FLEX 코드 (간신히 일부복원 ^^)
<?xml version="1.0" encoding="utf-8"?>
<?xml:namespace prefix = "mx" />
<mx:Application layout="absolute" xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="aaa()">
<mx:RemoteObject id=ro destination="ListWaterDayRO" showBusyCursor="true">
</mx:RemoteObject>
<mx:Script>
</mx:Script>
<mx:DataGrid id=dg x="57" y="37"></mx:DataGrid>
<mx:Button x="57" y="203" label='click="ro.read(1)"' click="ro.read(1)"></mx:Button>
</mx:Application>
플렉스 실행결과]