標籤:android ios app app伺服器開發 移動開發
6.2 開發提高
請學習同一下載包中的開發手冊中的基本標籤語言及運算式
6.3 精通移動App應用服務程式開發
熟悉輕開平台針對移動App(json格式)的規則及開發例子
除了基本開發標籤語言及運算式(參見同一下載包中的開發手冊)外,輕開平台特別針對移動App最常用的json文字格式設定開發的對應規則:
? 副檔名須為json(如:one.json)或用JspEasy擴充的jsp檔案名稱
? 檔案內容須為閉合的json格式,靜態內容則可直接書寫json格式,如:
{“item”: {<chtml>… …</chtml> },”other”:”other value”}
? value屬性參數表示輸出不帶引號的值,如:
<price value>@{item:price}</price>
輸出:”price”:51.24
? list屬性參數表示輸出為數組列表格式,end屬性參數表示數組結束的位置(跟for的end值相等)
<for bags=item end="@{item:getLength}"> <item list="@{item:getSuffix}" end="@{item:getLength}"> <!-- list屬性參數表示輸出為數組列表格式,end屬性參數表示數組結束的位置(跟for的end值相等) --> <name>@{item:name}</name> <price value>@{item:price}</price> <unit>@{item:unit}</unit> </item></for>
? nolast屬性參數表示數組後邊輸出一個逗號
<for bags=item end="@{item:getLength}"> <item list="@{item:getSuffix}" end="@{item:getLength}" nolast> <!-- list屬性參數表示輸出為數組列表格式,end屬性參數表示數組結束的位置(跟for的end值相等), nolast屬性參數表示數組後邊輸出一個逗號--> <name>@{item:name}</name> <price value>@{item:price}</price><!-- value屬性參數表示輸出不帶引號的值 --> <unit>@{item:unit}</unit> </item></for><tatol>@{item:getLength}</tatol><!-- 前邊的nolast就是用於在這組前邊輸出一個逗號 -->
? nokey屬性參數表示不輸出數組名稱
<for bags=item end="@{item:getLength}"> <item list="@{item:getSuffix}" end="@{item:getLength}" nokey> <!-- list屬性參數表示輸出為數組列表格式,end屬性參數表示數組結束的位置(跟for的end值相等), nokey屬性參數表示不輸出數組名稱--> <name>@{item:name}</name> <price value>@{item:price}</price><!-- value屬性參數表示輸出不帶引號的值 --> <unit>@{item:unit}</unit> </item></for>
? 無名稱數組直接累成字串輸出即可
<chtml><!-- 正式json格式的內容,無名稱數組直接累成字串輸出即可 --><for bags=item end="@{item:getLength}"> <if x="@{item:getSuffix}" else=1> <bag id=pPage x=0><we name=name>"@{item:name}"</we></bag> <bag id=pPage><we name=name>@{pPage:name},"@{item:name}"</we></bag> </if></for></chtml>[@{pPage:name}]
? 空數組直接輸出:
[]
整套規則仍然突出Easy,幾乎一看就能掌握。後邊將結合執行個體進行學習
相關資源下載:
移動App應用伺服器開發從入門到精通:http://download.csdn.net/detail/tx18/8741611
快速搭建移動App伺服器 :http://download.csdn.net/detail/tx18/8737507
輕開平台會不定期升級為大家提供更多強大而Easy的功能,請留意下載最新的版本:http://download.csdn.net/user/tx18
提高到精通移動(android、IOS)App應用服務程式開發