# Add external Java class

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 ![](/files/8GOoMa46IMrRE0IQfLZ6)and drop to the entity.<br>

![](/files/LfN6o6RR9faTshLEKRQK)

Click ![](/files/7kn2iTFD91HkZnY0XFCB)to open **Module Action Field Configuration**.

1. Select Process Name: **UPDATE**

Enter Class Action: **com.training.manual.ApplicationManualClass,** click OK to save dialog.

![](/files/yZPJkIi1mwJ1ftSAzcoe)

Perform the steps **2** - **5**. for the Process Name: **INSERT**

Click ![](/files/c5HKzGYy8fBl3GUAs8OH)Save the configuration.

**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.

![](/files/Y5uTem9LnDAgA4WXUO7g)

The class generated should look like :

```
package com.training.manual;

import java.util.Vector;


import com.master.util.ProcessAction; 
import com.master.util.ProcessHelper;

public class ApplicationManualClass extends ProcessHelper implements ProcessAction {

	@Override
	public Vector modifyResult() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean validateResult() {
		// TODO Auto-generated method stub
		return false;
	}
}
```

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.

```
package com.training.manual;

import java.util.HashMap; 
import java.util.Vector;

import com.master.util.ProcessAction; 
import com.master.util.ProcessHelper;

public class ApplicationManualClass extends ProcessHelper implements ProcessAction {

	@Override
	public Vector modifyResult() {

		Vector vDataModels = getResultForProcess();
		String buttonAction = request.getParameter("SUBMIT_BUTTON");
	
		System.out.println("######## data: " + vDataModels);
		System.out.println("######## buttonAction: " + buttonAction);
	
		return vDataModels;
	}

	@Override
	public boolean validateResult() {
		return true;
	}

	@Override
	public HashMap modifyLoadUpdateResult() {
		return super.modifyLoadUpdateResult();
	}
}
```

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:

![](/files/I1krfnNmzFrsnfcw2CJi)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.oneweb.tech/oneweb/design-and-develop-oneweb-apps/design-and-develop-ux-ui/ux-ui-customization/smart-form-customization/add-external-java-class.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
