About This Space

A simple Demo of how to deploy EJS templates from a stateful Node.js script


Last updated on November 9, 2019

Public Permissions:   View   Open/Fork   Run   Comment  

Stateful EJS Template

This simple template demonstrates the use of EJS in a stateful environment. EJS stands for Embedded JavaScript templating. For more information, visit http://ejs.co.

Statefulness

This app uses a stateful top-down paradigm, meaning that when a screen is displayed, the Node.js code is paused to wait for the user's input. In a stateful program, EJS screens can intermingle with Rich Display screens built using the Visual Designer tool.

Strongly typed fields

This app uses strongly typed fields and the pjs.define() API.

At its core, JavaScript is a loosely typed language, which means you do not have to declare the data types of variables explicitly. JavaScript variables assume a data type based on the content that is placed in them.

However, for business applications, being able to explicitly specify a data type can be extremely useful. For example, you may want to strongly type an amount field, so that it can only hold numeric data with a specific precision (length and decimal positions). In a business application, putting character data into an amount field should raise an exception.

API

  • pjs.define() - Define a strongly typed field
  • pjs.display() - Display content from an EJS template and wait for the user to respond

Be the first to comment:      

Comments

Write Preview Markdown: bold italic code link
Post

Filters:

Popular Recent

4322

0

0

Application to output numbers and their squares to the console

4155

0

0

This workspace deploys a custom server

4081

0

0

This workspace deploys a custom server

4138

0

0

This workspace shows you how to add custom widgets to your project

4120

0

0

This interactive app prompts the user for key fields to lookup a database record and displays the results

4172

0

0

This interactive app prompts the user for key fields to lookup a database record and displays the results

4280

0

0

Demo app to use EJS to display information from a database

4300

0

0

Demo app to use EJS to display information from a database

4332

0

0

This workspace illustrates the basic setup of an HTML page that includes external JavaScript and CSS files

4141

0

0

Displaying information in grids is fundamental to developing applications. This demo application displays a list of products in a grid.

4345

0

0

Simple output to a browser from Node.js

4300

0

0