Previous Next vertical dots separating previous/next from contents/index/pdf

New Action Wizard

Use this wizard to create new actions in a NetUI controller class.

How To Open This Wizard

There are three ways to open this wizard:

How To Use This Wizard

This wizard provides different templates for creating different kinds of actions. The template is selected from the dropdown list named Action Templates.

The following table describes each available template shows typical action code created by the template.

Action Template Descriptions

Template Description
Simple Declarative Action

Adds a @Jpf.SimpleAction annotation to the controller class.

    @Jpf.Controller(simpleActions = {
        @Jpf.SimpleAction(name = "simpleDeclarativeAction", ...) }
    public class CustomerManagementController extends PageFlowController
Basic Method Action

Adds a minimal action method to the controller class.

    @Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "customers.jsp") })
    public Forward basicMethodAction(FormBean form) {
        Forward forward = new Forward("success");
        return forward;
    }
Control Method Call

Adds an action method that (1) takes a Form Bean parameter (provided the control method takes input), (2) calls a control method, and (3) forwards the result of the control method to a page input (provided the control method returns something other than void).

    @Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "customers.jsp", actionOutputs = { @Jpf.ActionOutput(name = "returnValueName", type = model.Customer.class) }) })
    public Forward controlMethodCall(FormBean form) {
        Forward forward = new Forward("success");
        java.lang.Integer id = form.getCustomer().getId();
        model.Customer returnValueName = customerControl.getCustomerById(id);
        forward.addActionOutput("returnValueName", returnValueName);
        return forward;
    }
Get Item For Display Via Control

Adds an action that takes an item off the user request and forwards the item as an action output to a JSP page input.

    @Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "customers.jsp", actionOutputs = { @Jpf.ActionOutput(name = "returnValueName", type = model.Customer.class) }) })
    public Forward getItemForDisplay() {
        Forward forward = new Forward("success");
        String param1 = getRequest().getParameter("id");
        java.lang.Integer id = TypeUtils.convertToIntegerObject(param1);
        model.Customer returnValueName = customerControl.getCustomerById(id);
        forward.addActionOutput("returnValueName", returnValueName);
        return forward;
    }
Get Item For Edit Via Control

Adds an action that takes an item off the user request and forwards the item as an output form.

    @Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "customers.jsp") })
    public Forward getItemForEdit() {
        Forward forward = new Forward("success");
        String param1 = getRequest().getParameter("id");
        java.lang.Integer id = TypeUtils.convertToIntegerObject(param1);
        model.Customer returnValueName = customerControl.getCustomerById(id);
        GetItemForEditFormBean outputForm = new GetItemForEditFormBean();
        outputForm.setReturnValueName(returnValueName);
        forward.addOutputForm(outputForm);
        return forward;
    }
Delete Item Via Control

Adds an action that takes an item off the user request and invokes a delete method on the control.

    @Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "customers.jsp", actionOutputs = { @Jpf.ActionOutput(name = "returnValueName", type = model.Customer.class) }) })
    public Forward deleteItem() {
        Forward forward = new Forward("success");
        String param1 = getRequest().getParameter("id");
        java.lang.Integer id = TypeUtils.convertToIntegerObject(param1);
        model.Customer returnValueName = customerControl.deleteCustomerById(id);
        forward.addActionOutput("returnValueName", returnValueName);
        return forward;
    }
Add Item Via Control

Add an action that takes data from the posted form and invokes an add method on the control.

    @Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "customers.jsp", actionOutputs = { @Jpf.ActionOutput(name = "returnValueName", type = model.Customer.class) }) })
    public Forward addItem(FormBean form) {
        Forward forward = new Forward("success");
        java.lang.Integer id = form.getCustomer().getId();
        model.Customer returnValueName = customerControl.getCustomerById(id);
        forward.addActionOutput("returnValueName", returnValueName);
        return forward;
    }
Update Item Via Control

Takes data from the posted form and invokes an update method on the control.

    @Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "customers.jsp", actionOutputs = { @Jpf.ActionOutput(name = "returnValueName", type = model.Customer.class) }) })
    public Forward updateItem(FormBean form) {
        Forward forward = new Forward("success");
        java.lang.Integer id = form.getCustomer().getId();
        model.Customer returnValueName = customerControl.getCustomerById(id);
        forward.addActionOutput("returnValueName", returnValueName);
        return forward;
    }

The table below explains the role of each field in the action templates.

Field Descriptions

Field Description
Action Name

Specifies the action name. For method actions this is the method name:

    public Forward actionName()

For simple actions, this is the name attribute on the @Jpf.SimpleAction annotation.

    @Jpf.Controller(simpleActions = { @Jpf.SimpleAction(name = "actionName", ...)

Control

Specifies the control class that is called by the action, shown in bold type below.

	@Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "customers.jsp", actionOutputs = { @Jpf.ActionOutput(name = "returnValueName", type = model.Customer.class) }) })
	public Forward actionName(FormBean form) {
		Forward forward = new Forward("success");
		java.lang.Integer id = form.getCustomer().getId();
		model.Customer returnValueName = customerControl.getCustomerById(id);
		forward.addActionOutput("returnValueName", returnValueName);
		return forward;
	}
Control Method

Specifies the control method that is called by the action, shown in bold type below.

	@Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "customers.jsp", actionOutputs = { @Jpf.ActionOutput(name = "returnValueName", type = model.Customer.class) }) })
	public Forward actionName(FormBean form) {
		Forward forward = new Forward("success");
		java.lang.Integer id = form.getCustomer().getId();
		model.Customer returnValueName = customerControl.getCustomerById(id);
		forward.addActionOutput("returnValueName", returnValueName);
		return forward;
	}
Form Bean

Specifies the parameter (= a form bean) of the action method.

	@Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "customers.jsp", actionOutputs = { @Jpf.ActionOutput(name = "returnValueName", type = model.Customer.class) }) })
	public Forward actionName(FormBean form) {
		Forward forward = new Forward("success");
		java.lang.Integer id = form.getCustomer().getId();
		model.Customer returnValueName = customerControl.getCustomerById(id);
		forward.addActionOutput("returnValueName", returnValueName);
		return forward;
	}
Forward To

Specifies the JSP page or action that is the target of this action.

	@Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "customers.jsp", actionOutputs = { @Jpf.ActionOutput(name = "returnValueName", type = model.Customer.class) }) })
	public Forward actionName(FormBean form) {
		Forward forward = new Forward("success");
		java.lang.Integer id = form.getCustomer().getId();
		model.Customer returnValueName = customerControl.getCustomerById(id);
		forward.addActionOutput("returnValueName", returnValueName);
		return forward;
	}
Return Value Name

Specifies the variable name of the data returned by the control method invocation, shown in bold below.

	@Jpf.Action(forwards = { @Jpf.Forward(name = "success", path = "customers.jsp", actionOutputs = { @Jpf.ActionOutput(name = "returnValueName", type = model.Customer.class) }) })
	public Forward actionName(FormBean form) {
		Forward forward = new Forward("success");
		java.lang.Integer id = form.getCustomer().getId();
		model.Customer returnValueName = customerControl.getCustomerById(id);
		forward.addActionOutput("returnValueName", returnValueName);
		return forward;
	}

Related Topics

Tutorial: Accessing Controls from a Web Application: Step 3: Create a Data Grid

Tutorial: Accessing Controls from a Web Application: Step 4: Create a Page to Edit Customer Data

Apache Beehive documentation: Actions

 

Skip navigation bar   Back to Top