Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebSphere Commerce: Controller Command vs. Task Command?

For a newbie, how would you explain the difference between a controller command and a task command? What are the purposes of each? What might be an example of using the two types of commands?

like image 430
Chandrew Avatar asked Feb 24 '26 01:02

Chandrew


2 Answers

See this documentation: http://pic.dhe.ibm.com/infocenter/wchelp/v6r0m0/index.jsp?topic=%2Fcom.ibm.commerce.developer.doc%2Fconcepts%2Fcsdcommand_framework.htm

Basically a task is a step in the larger process. A controller generally calls the tasks necessary to complete the entire process. If you have two processes (command controllers) that need the same task, they each call the task and no need to replicate that task's behavior in each controller.

Think of making a peanut butter sandwich and making a ham sandwich as your two command controllers. Getting a plate, putting bread on plate, and place top bread slice on sandwich would be shared. Getting ham, or getting PB would be tasks only used in the appropriate command controller.

like image 60
Erik Nedwidek Avatar answered Feb 25 '26 14:02

Erik Nedwidek


The Controller Command is the command that gets called upon a request, just like we have actions in struts and controller in Spring. A task is a step in the bigger process. Task commands are the commands that perform specific tasks for a controller command, like service classes in other frameworks. In order to complete the request, a controller command may invoke multiple task commands.

Other differences are - a. There is a url mapping for a controller command whereas Task commands don't have URLs mapped to them. b. Controller command gets invoked before the task command.

like image 41
Vivek Vermani Avatar answered Feb 25 '26 15:02

Vivek Vermani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!