Spring bean mod02
View more presentations from Guo Albert.
package vo
{
public class People
{
public function People(iName:String, iGender:String, iMail:String)
{
name = iName;
gender = iGender;
mail = iMail;
}
public var name:String;
public var gender:String;
public var mail:String;
}
}
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:components="com.hillelcoren.components.*"
layout="absolute" >
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:components="com.hillelcoren.components.*"
layout="absolute" initialize="init()">
<mx:Script>
<![CDATA[
import vo.People;
import mx.collections.ArrayCollection;
//declare an ArrayCollection as AutoComplete component's data provider
[Bindable]
private var peopleList:ArrayCollection = new ArrayCollection();
//set data into people list as page load
private function init():void{
peopleList.addItem(new People("Albert", "Male", "albert@gmail.com"));
peopleList.addItem(new People("Mandy", "Female", "mandy@gmail.com"));
peopleList.addItem(new People("Verio", "Male", "verio@gmail.com"));
peopleList.addItem(new People("Richard", "Male", "richard@gmail.com"));
peopleList.addItem(new People("Andrew", "Male", "andrew@gmail.com"));
}
]]>
</mx:Script>
<mx:HBox>
<mx:Label text="Name" />
<components:AutoComplete id="autoComplete" labelField="name" dataProvider="{peopleList}" />
</mx:HBox>
</mx:Application>
1: 2010/1/20 下午 04:25:59 org.apache.catalina.core.ApplicationContext log
2: 資訊: Initializing Spring FrameworkServlet 'spring-flex'
3: 2010/1/20 下午 04:26:00 org.apache.catalina.core.ApplicationContext log
4: 嚴重的: StandardWrapper.Throwable
5: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/flex]
6: Offending resource: ServletContext resource [/WEB-INF/flex-servlet-context.xml]
7: at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
8: at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)