Tuesday, January 10, 2023

Using Database Tags in HTML File

1.     Overview

This is a small note or idea about using database tags embedded in HTML file to display data stored in a database instead of writing codes in a HTML files to query and display data.

2.     Descriptions 

Back in 2003, I developed a system with J2EE for Air Canada to display equipment on an airplane while I was working at Scanpak Inc. The GUI was developed by another developer. I got the html file, and I had to embed Java codes on the HTML file in order to query database and display proper equipment for those web pages.

Recently I had created several blogs on BlogSpot, which is owned by Google.  By viewing the html for a post, I could edit those html files for errors by BlogSpot, when it converted the word document into html for display.

As always the html tags are like spaghetti. I don’t want to read spaghetti codes, which would consume too much time for a little work or achievement.

The following ideas would be a proposal to avoid writing codes on an html file to display data stored in a table’s column in database.

Developers would create temporary or displayed table and columns in database for display on the web page. Of course, all coding process would be done in the backend to store proper data in those temporary tables.

a.       On the web page or html file, we would only need to specify connection string, table nameà column name; and then data on that column would be query and display on that web location. For example, in the html file there are 2 lines of tags

·         Open DatabaseàCanada

·         Table OntarioàToronto

The web page would open the database named Canada. It would query table Ontario and display all rows (line by line) in the column Toronto.

b.      If you wanted a table with several columns displayed on the web, then a join statement would be needed, for example

·         Open DatabaseàCanada

·         Table OntarioàToronto_Street “space or appropriated short html tag” AND OntarioàToronto_PostalCode “space or appropriated short html tag” AND OntarioàToronto_TelephoneNumber

·         Close DatabaseàCanada

Data will be displayed row by row until the end of the Toronto table.

c.       Refreshing data on the web could be done with key work such as “Refresh 2 min”. The UI would query database every 2 minutes and refresh data. 

Open DatabaseàCanada

Table OntarioàToronto_Street “space or appropriated short html tag” AND OntarioàToronto_PostalCode “space or appropriated short html tag” AND OntarioàToronto_TelephoneNumber 

Refresh 2 min 

d.      An alternative way would be create a button for user to refresh data.

e.       Automatic refresh from the backend, when new data arrived, would require communication between the UI web and its backend. You could use keyword such as update to trigger refreshing data requested by the backend. 

Open DatabaseàCanada

Table OntarioàToronto_Street “space or appropriated short html tag” AND OntarioàToronto_PostalCode “space or appropriated short html tag” AND OntarioàToronto_TelephoneNumber 

Update 
-------------------------------------

Written and posted on 2023-01-05

No comments:

Post a Comment