<AppML> Case Study - Prototyping
This case study demonstrates how to build a full <AppML> Internet application,
with functions for listing, editing, and searching information from several tables in
a database.
Prototyping
In this chapter we will set up a prototype model for each table in the database.
Prototypes are very handy starting point for developing applications.
Prototype Models
First, create a folder for the prototypes. Name the folder Prototypes.
Then, create a prototype model for each table in the database.
Use SELECT * from each table, and save the models as XML files:
Model: Proto_Customers.xml
<appml>
<datasource>
<database>
<connection>AppmlDemo</connection>
<sql>SELECT * FROM Customers</sql>
</database>
</datasource>
</appml>
Model: Proto_Suppliers.xml
<appml>
<datasource>
<database>
<connection>AppmlDemo</connection>
<sql>SELECT * FROM Suppliers</sql>
</database>
</datasource>
</appml>
Model: Proto_Products.xml
<appml>
<datasource>
<database>
<connection>AppmlDemo</connection>
<sql>SELECT * FROM Products</sql>
</database>
</datasource>
</appml>
Prototype Views
Create a prototype view, save it as Demo_Prototype.html, and try it
yourself:
View: Demo_Prototype.htm
<h1>Customers</h1>
<div id="List01"></div>
<script src="appml.js"></script>
<script>
customers=new
AppML("appml.aspx","Prototypes/Customers");
customers.run("List01");
</script>
Try it yourself »
All Together Now
Finally, with a little JavaScript coding, create a simple
prototype page for all prototype models:
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.aspx","Prototypes/" + pname);
app_obj.run("Place01");
}
</script>
</body>
</html>
Show it »
Color Picker