1. enable datasource
2. backend
http://10.10.10.90:8888/pembelian_api.cfm
[root@teguhth-all ROOT]# pwd
/opt/lucee/tomcat/webapps/ROOT
[root@teguhth-all ROOT]#
[root@teguhth-all ROOT]# cat pembelian_api.cfm
<cfquery name="qPembelian" datasource="dbteguhth">
SELECT
KODE_PEMBELIAN,
KODE_BARANG,
KODE_CUSTOMER,
TANGGAL_PEMBELIAN,
JUMLAH_PEMBELIAN
FROM pembelian
</cfquery>
<cfcontent type="application/json">
<cfoutput>#serializeJSON(qPembelian)#</cfoutput>
[root@teguhth-all ROOT]#
3. frontend
http://10.10.10.90:8888/pembelian_front.cfm
[root@teguhth-all ROOT]# pwd
/opt/lucee/tomcat/webapps/ROOT
[root@teguhth-all ROOT]#
[root@teguhth-all ROOT]# cat pembelian_front.cfm
<!--- QUERY BACKEND --->
<cfquery name="qPembelian" datasource="dbteguhth">
SELECT *
FROM pembelian
</cfquery>
<!--- FRONTEND --->
<!DOCTYPE html>
<html>
<head>
<title>Data Pembelian</title>
<style>
body {
font-family: Arial;
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #ccc;
padding: 8px;
text-align: left;
}
th {
background: #f2f2f2;
}
</style>
</head>
<body>
<h2>Data Pembelian</h2>
<table>
<tr>
<th>Kode Pembelian</th>
<th>Kode Barang</th>
<th>Kode Customer</th>
<th>Tanggal</th>
<th>Jumlah</th>
</tr>
<cfoutput query="qPembelian">
<tr>
<td>#KODE_PEMBELIAN#</td>
<td>#KODE_BARANG#</td>
<td>#KODE_CUSTOMER#</td>
<td>#dateFormat(TANGGAL_PEMBELIAN,"dd-mm-yyyy")#</td>
<td>#JUMLAH_PEMBELIAN#</td>
</tr>
</cfoutput>
</table>
</body>
</html>
[root@teguhth-all ROOT]#






No comments:
Post a Comment