I will explain how to change Wagby's standard screen transition using script.
Set "Screen> Script> Controller".
First of all, you specify the script of which screen to write.
"Execution timing" is prepared for each screen.The script is called after the specified timing is over.
When helper is registered, the XXXHelper # beforeInsert method calls the script.This is called "just before" to register in the database.
On the other hand, the registration process of the controller is called just before the database registration process etc. are all completed and control is transferred to the screen display (JSP).
The purpose of creating a controller script is to change the Wagby standard screen transition rule. Specifically, it is described as follows.
return "redirect:/" + 遷移先の画面種別 + モデルID + アクション文字列
return "forward:/" + 遷移先の画面種別 + モデルID + アクション文字列
The prefix "redirect: /" or "forward: /" is required.The difference between them is explained in the section on "Redirect and Forward".Please use "redirect: /" as the standard.The screen type conforms to the specification of the SCREENTYPE function.The model ID is capitalized at the beginning.(Example: For customer model, it is Customer.Please check the action string with the sample from the next section.
If there is no change in the screen transition, you can omit the return statement.Write only the additional code.
In order to carry out consecutive registration processing, it is an example in which it switches to the registration screen again after ending the registration screen.
You can pass the value selected on the previous registration screen to the recalled registration screen and display it as the initial value.
For example, to pass the value of another item reference (list box) item item 1, do as follows.
On the receiving side (item 1), write the following formula in the initial value (when the registration screen is displayed).
To assign more than one parameter, separate each parameter with &.
Apply the REQUEST () function to the initial value (when the registration screen is displayed) for all receiving side items.
Consideration of character encoding is necessary when assigning a Japanese character string (including a character string other than the English-speaking region, including) as a parameter.
Here I will show you how to use utility class jp.jasminesoft.util.WebStringEncodeUtilities provided by Wagby.
var WebUtils = Java.type("jp.jasminesoft.util.WebStringEncodeUtilities"); return "redirect:/insertCustomer.do?action_New=New&customername="+WebUtils.encodeString(customer.getCustomername());
When specifying the next screen transition destination with return, specify either the prefix forward or redirect.The difference between the two is as follows.
|Process flow||Take the request (request) from the browser to the destination specified by forward.||Once the process is returned to the browser, the browser continues to make a new request (request) to the redirect destination.|
|Proper use||From the viewpoint of the browser, it is effective when it can be regarded as "one (series)" processing including the processing at the forward destination.Used for limited purposes, such as returning to the same screen.||It is effective when you want to complete the process once and want to proceed to the next process.When transitioning to another screen, in principle use this.|
|Viewpoint of user (browser)||Completion by one communication.Inside "Process 2" is also done, but the user does not notice it.Although the result is transmitted from process 2, it is interpreted that the user is "the result of requesting process 1".||Communication occurs twice.Upon receiving the first result, a request to open the next screen occurs.|
|The value of p.request||It can also be used in the destination specified by forward.Note that in the case of screens with different transition destinations, if the transition source value is inherited, it will cause malfunction.||It can not be used on the destination specified by redirect.|
Scripts that run are generated in the WEB-INF/script/model ID folder according to the following file naming convention.
操作アクション + モデル名 + "_" + ボタン操作でサーバに送られる文字列.js
This script indicates that the predetermined action process has endedlaterIt is called.Specific examples of file names are shown below.
You can not write a script on the list update screen.This is because there is a danger of erroneous operation due to script behavior change due to the internal operation being complicated.
You can not specify screen transition in the script of the form output (including batch output).(Even if you specify it, it will be ignored.)