Add external Java class
Last updated
Last updated
The entity action allows you to use Java code to extend the functionality of your application in ONEWEB. This section will show you how to add custom Java code to your entity.
Configuring Class Action
Go to AppDesigner and open your entity.
In the navigator pane, under Tool -> Action, Drag and drop to the entity.
Select Process Name: UPDATE
Enter Class Action: com.training.manual.ApplicationManualClass, click OK to save dialog.
Perform the steps 2 - 5. for the Process Name: INSERT
Create a Java Class file using Eclipse
From the Eclipse IDE, On the Project Explorer Pane, right-click on /MasterWeb/Java Sources/src folder, select New > Class, and name the class ApplicationManualClass. Click Finish to create the Java Class file.
The class generated should look like :
There are 2 default methods generated.
public Vector modifyResult(): to modify the submitted data model before process INSERT/UPDATE/DELETE to the database.
public boolean validateResult() : to validate submitted data model, return true if validate pass.
Modify ApplicationManualClass to print out submitted data and the name of clicked button.
In the Servers view, right-click the server and select Publish from the menu. The state changes to Synchronized once the project has been deployed to the server.
To test the ApplicationManualClass class, open http://<host>:8080/FrontWeb in web browser and login application.
Click Create Application menu to open Create Application screen.
Click Add button.
In Application Detail, enter data of application and click Submit button.
In the Eclipse, Open Console tab, the standard out should display like this:
Click to open Module Action Field Configuration.
Click Save the configuration.