Support > Repository > Business logic
ja | en

In Wagby, complicated business logic can be described by "script". This script is JavaScript grammar.

In Java execution environment "server side JavaScript" is provided.Because this is a scripting language, no build process is needed.After editing the script file, you can immediately confirm the operation by reloading the screen.

Figure 1 Script input

Clicking on the script column starts the editor.

Figure 2 Script editor
The text editor is open source Ace Are bundled.

Two JavaScript

Generally speaking, "JavaScript" is known as client-side JavaScript running on a Web browser.This is used for manipulation of HTML elements, mainly describing processing related to "screen rendering".

The script (server side JavaScript) described in this chapter is used to manipulate Java objects.I use the same JavaScript language, but the purpose is different.The scripts described here describe business logic.You can not customize the screen display.

Figure 3 Server side JavaScript and client side JavaScript
In this manual, we refer to server side JavaScript as "script".

Supplement of server side JavaScript technology

Server side JavaScript technology is standard built in Java 8.Java 8 comes with an engine called Nashorn.(In Java 6/7, an engine called Rhino of the previous generation is bundled.)

Although this technique is "grammar is JavaScript", it has the feature that "you can manipulate Java objects from programs written in JavaScript".Moreover, it is unnecessary to build and it can be operated immediately. That isThe scripts provided by Wagby are not proprietary languages, they use the standard technology provided by Java.

(1) Preparation and operation confirmation
I will explain how to use script from Wagby.
(2) Writable script
You can write scripts called at the timing of processing on Designer.
(3) Model basics (1)
I will explain how Wagby's model is structured. I will explain how to operate the basic store model among them.
(4) Model basics (2)
Describe the presentation model, condition model, list model.
(5) Details of generated script file
The script entered in Designer is generated as a file.
(6) Using the Wagby function
Functions provided by Wagby can also be used in code.
(7) Primary key
I will explain how to set arbitrary format using a script.
(8) Initial value
Explain how to set initial values ​​using scripts.
(9) Input check/Consistency check
I will explain how to implement complex input check and consistency check with script.
(10) Input filter
You can write a "filter" process to convert the value entered from the Web form by a script.
(11) Mass update
We describe the body of "bulk update" processing prepared on the list display screen with a script.
(12) Update after list form output
After executing the form output, I will introduce the script to be called.
(13) Screen transition
I will explain how to change Wagby's standard screen transition using script.
(14) Cross-model calculation (transaction)
The calculation across the model is "transaction". This section explains how to create transaction scripts.
(15) Using Service/Dao class, helper, SQL
You can use the Service/Dao class (automatically generated by Wagby) from the script. You can also use SQL.
(16) Send an email
I will explain how to send mail from a script.
(17) Sample code
I will show sample code that I can use for work.
(18) Points to note when using Java 6/7
In Java 6/7 there are some different scripting rules.