MACROMEDIA FLEX-GETTING STARTED WITH FLEX Instrukcja Użytkownika Strona 91

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 148
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 90
<mx:Button x="130" y="95" label="Get Shipping Options"
click="xmlRPC.send();"
width="160" height="22"/>
<mx:DataGrid dataProvider="{shippingInfo}"
x="80" y="141" width="262" height="92"
id="shippingOptionsList"
editable="false" enabled="true">
<mx:columns>
<mx:DataGridColumn headerText="Service"
dataField="service" />
<mx:DataGridColumn headerText="Price" dataField="price" />
</mx:columns>
</mx:DataGrid>
</mx:Application>
Now that we have the Flex client side of the code, let’s take a
look at what we need on the server.
The Server Code in ColdFusion
You can write the server code in whatever server technology
you like (e.g., PHP, Java, Rails, etc.). I’ve chosen to use Cold-
Fusion here, but you can find the code for the other server
models on the O’Reilly web page for this book.
The ColdFusion version of the text return page appears in
Example 5-5.
Example 5-5. PlainHttpService.cfm
<cfsetting enablecfoutputonly="true" />
<cfinvoke component="Shipping"
method="getShippingOptions" argumentcollection="#url#"
returnvariable="myResult" />
<cfloop index="i" from="1" to="#ArrayLen(myResult)#">
<cfoutput>#myResult[i].service#: #dollarFormat
(myResult[i].price)#<br
/></cfoutput>
</cfloop>
The XML version of the interface appears in Example 5-6.
Using the HTTPService Tag | 75
Przeglądanie stron 90
1 2 ... 86 87 88 89 90 91 92 93 94 95 96 ... 147 148

Komentarze do niniejszej Instrukcji

Brak uwag