Develop > Presentation layer > Customize WebSphere Commerce Accelerator, Organization Administration Console, or Administration Console > Tools framework > Dialogs
Example: Wizard, dialog or notebook controller command
This example controller command defines a wizard, dialog, or notebook.
package com.ibm.commerce.tools.test; import java.util.*; import com.ibm.commerce.ras.*; import com.ibm.commerce.server.*; import com.ibm.commerce.command.*; import com.ibm.commerce.exception.*; import com.ibm.commerce.datatype.*; import com.ibm.commerce.tools.common.*; import com.ibm.commerce.tools.command.*; import com.ibm.commerce.tools.common.ui.*; import com.ibm.commerce.exception.*; import com.ibm.commerce.tools.resourcebundle.*; import com.ibm.commerce.tools.util.*; public class TestCmdImpl extends ToolsControllerCommandImpl implements TestCmd { protected ResourceBundleProperties resourceBundle = null; protected String viewname = null; protected String successMsg = "Success"; protected String errorMsg = "Error"; // sample input data protected String name = null; protected int age; protected float salary; protected String department = null; public void performExecute() { /* * the business logic here */ // exit successfully - forwarding to returning view responseProperties = new TypedProperty(); responseProperties.put(ECConstants.EC_VIEWTASKNAME, viewname); responseProperties.put(UIProperties.SUBMIT_FINISH_MESSAGE, successMsg); } public void validateParameters() throws ECException { String methodName = "validateParameters"; /* optionally, load the resource bundle file and NL messages Locale locale = commandContext.getLocale(); resourceBundle = (ResourceBundleProperties) ResourceDirectory.lookup("samples.samplesNLS", locale); successMsg = (String) resourceBundle.get("successMsg"); errorMsg = (String) resourceBundle.get("errorMsg"); */ // retrieve the data which was set on the client using parent.put name = (String) requestProperties.getString("name", null); age = requestProperties.getIntValue("age", 0); salary = requestProperties.getFloatValue("salary", 0); department = (String) requestProperties.getString("department", null); // set returning URL view name viewname = requestProperties.getString(ECConstants.EC_REDIRECTURL); /* error use case - returning error code and message to view command via ECException if (salary < 10000.00 || salary > 99999.99) { responseProperties = new TypedProperty(); responseProperties.put(UIProperties.SUBMIT_ERROR_STATUS, "101"); responseProperties.put(UIProperties.SUBMIT_ERROR_MESSAGE, errorMsg); throw new ECApplicationException( ECToolsMessage.TOOLS_TEST_USER_ERROR, this.getClass().getName(), methodName, null, viewname, responseProperties); } */ } }
Related concepts
Related tasks