Samples
Sample Back-end Web Service
For example, the following file is located in the
services
directory.
class MyWebService {
void myWebMethod(JSONObject injson, JSONObject outjson) {
int num1 = injson.getInt("num1");
int num2 = injson.getInt("num2");
outjson.put("result", num1 + num2);
}
}
Sample Front-end Use Of Web Service
The following front-end example utilizes the web service defined above.
let data = {
num1: 22,
num2: 11
};
let res = await Server.call("services/MyWebService", "myWebMethod", data);
if (res._Success) {
let result = res.result;
//...
}
Full authentication and error handling occurs automatically. (The user must have logged in first.)
HTML Component Usage
Developers may use any of the supplied tags or may define your own.
Custom tags may encapsulate any amount of HTML, CSS, and JavaScript code and may be re-used in any number of places.
To use a component add to HTML:
<my-component></my-component>
And add to JavaScript:
utils.useComponent('MyComponent');
Kiss also supports tag-less components that can encapsulate arbitrary functionality including pop-up windows.
Database API
Kiss comes with a powerful library for accessing SQL databases.
This API provides the following benefits:
- Automatic connection and statement pooling
- Vastly simpler API than bare JDBC
- Handling of parameterized arguments
- Auto generation of SQL for single record adds, edits, and deletions
- Auto handling for cases of cursor interference on nested queries
- Supports transactions out-of-the-box
Single Page Application
Kiss applications are single page applications in the sense
that there is a single
<body>
tag and all other pages
essentially get placed into that tag on a single page. However,
Kiss is not a single page application in the sense that the
entire application gets loaded with a single
GET
request. This
doesn't make sense for a large business application in which many
hundreds of pages may exist. Kiss lazy-loads pages as they are
used, and except for browser cache, eliminates them once another page
is loaded.