當前位置:
首頁 > 知識 > AppML>案例研究 之原型

AppML>案例研究 之原型

此案例研究演示了如何構建一個完整的 <AppML> 互聯網應用程序,具有針對資料庫中的若干表進行信息列舉、編輯和搜索的功能。



原型

我將為資料庫中的每個表建立一個原型模型。

原型是非常便於使用的開發應用程序的起點。



AppML>案例研究 之原型

原型模型

首先,為原型創建一個文件夾。該文件夾命名為 Prototypes。

然後,為資料庫中的每個表創建一個原型模型。

使用 SELECT * from 每個表,並保存模型為 XML 文件:

模型:Proto_Customers.xml

<appml>

<datasource>

<database>

<connection>Demo</connection>

<sql>SELECT * FROM Customers</sql>

</database>

</datasource>

</appml>

模型:Proto_Suppliers.xml

<appml>

<datasource>

<database>

<connection>Demo</connection>

<sql>SELECT * FROM Suppliers</sql>

</database>

</datasource>

</appml>

模型:Proto_Products.xml

<appml>

<datasource>

<database>

<connection>Demo</connection>

<sql>SELECT * FROM Products</sql>

</database>

</datasource>

</appml>



原型視圖

創建一個原型視圖,把它保存為 Demo_Prototype.html,並嘗試一下:

視圖:Demo_Prototype.htm

<h1>Customers</h1>

<div id="List01"></div>

<script src="appml.js"></script>

<script>

customers=new AppML("appml.php","Prototypes/Customers");

customers.run("List01");

</script>

嘗試一下 ?



現在把所有的合併在一起

最後,通過少量 JavaScript 編碼,為所有原型模型創建一個簡單的原型頁面:

Demo_Prototype_Views.htm

<!DOCTYPE html>

<html>

<head>

<link rel="stylesheet" href="appml.css" />

</head>

<body>

<h1>Demo Applications</h1>

<button onclick="myOpen("Customers")">Customers</button>

<button onclick="myOpen("Products")">Products</button>

<button onclick="myOpen("Suppliers")">Suppliers</button>

<button onclick="myOpen("Shippers")">Shippers</button>

<button onclick="myOpen("Categories")">Categories</button>

<button onclick="myOpen("Employees")">Employees</button>

<button onclick="myOpen("Orders")">Orders</button>

<button onclick="myOpen("OrderDetails")">OrderDetails</button>

<br><br>

<div id="Place01"></div>

<script src="appml.js"></script>

<script>

function myOpen(pname)

{

var app_obj

app_obj=new AppML("appml.php","Prototypes/" + pname);

app_obj.run("Place01");

}

</script>

</body>

</html>

喜歡這篇文章嗎?立刻分享出去讓更多人知道吧!

本站內容充實豐富,博大精深,小編精選每日熱門資訊,隨時更新,點擊「搶先收到最新資訊」瀏覽吧!


請您繼續閱讀更多來自 程序員小新人學習 的精彩文章:

JSP 客戶端請求
JSP 生命周期

TAG:程序員小新人學習 |