Universal data management and services using pure HTML. However, in order to collect data, you need a data repository. To avoid many of the problems that come with using a database server, you can collect this data in xml. Here is the basic structure of our project:
1 2 3 4 5 |
|
I initially limited the data to first name, last name and middle. The basic idea behind this page is that user information is obtained in this page. After the user information needs are satisfied, the process must be moved to the next logical collection step. To keep things simple I will wrap the user functionality into an asp class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
The CSQL class is built based on a data access layer (m_DAL) component MyPkg.MyDAL. This component is built based on the Fitch and Mather DAL components, which can be found on MSDN. This way we build a bridge between SQL Server and your code.
When the CUser object is initialized, it collects the Request data and uses the collectData() sub-function to put the collected data into a corresponding node in the UserDOM. (The code I won't explain because it's fairly easy to understand on its own.) After collecting the data (or not), we'll use XSL to transform the data content into a layout.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
This stylesheet will convert content into layout. Error checking is important, and stored procedures check data by determining whether it needs processing. Returns an "errors" node for each field that cannot be empty but does not have data populated. The output of this XML is roughly as follows:
1 |
|
This style sheet will convert the content into a layout. Error checking is important, and stored procedures check data by determining whether it needs processing. Returns an "errors" node for each field that cannot be empty but does not have data populated. The output of this XML is roughly as follows:
1 |
|
Note that if there is an error matching the node name, the resulting output will be red. We need the following ASP to combine all the previous things.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
ASP code creates a CUser object and fills in the data if there is data. The resulting HTML is then created via XSL transformation using CUser's DOM. The transformation is wrapped into a function called xslTransform. Also, remember to store the resulting CUser DOM into a hidden element. Or you can store the CUser DOM into a session variable and get it out during initialization.
After completing this page, you can create other pages based on the previous skeleton code. You have now created a copy-and-paste scenario for data collection. The most beautiful part of this solution is that all output is pure HTML, without any browser-specific properties or stylesheets. And because the functionality is wrapped into classes, you can use XSLT to generate layouts and the code runs pretty fast.
The above is the content of general data management and services using pure HTML. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!