Steps:
a. Create an interface (MyNewControllerCmd) extending com.ibm.commerce.command.ControllerCommand.
b. Create the class (MyNewControllerCmdImpl) extending com.ibm.commerce.command.ControllerCommandImpl and implementing the interface MyNewControllerCmd.
c. Create a CMDREG entry.
Eg:
insert into CMDREG (STOREENT_ID, INTERFACENAME, DESCRIPTION, CLASSNAME, TARGET)
values (storeent_ID,'com.ibm.commerce.sample.commands.MyNewControllerCmd',
'This is a new controller command for the business logic tutorial.',
'com.ibm.commerce.sample.commands.MyNewControllerCmdImpl','Local');
d. Make the struts entry for the command.
Eg:
com.ibm.commerce.sample.commands.MyNewControllerCmd
" path="/MyNewCmd" type="com.ibm.commerce.struts.BaseAction"/>
e. Create the access control policy
Eg:
CommandName="Execute">
ResourceBeanClass="com.ibm.commerce.sample.commands.MyNewControllerCmd">
f
. Stop server and load access control policies into database using acpload.bat file.
g. Basic methods to be implemented in the implementation class
i. setRequestProperties () - Method to set the request parameters.
ii validateParameters () - Method to perform validations of request parameters.
iii performExecute () - Method holds the business logic.
h. The command can now be executed with the following url
http:///webapp/wcs/stores/servlet/MyNewCmd?storeId=
Nice explanation
ReplyDelete