The terms Action and Controller should be very familiar to those who have experience with web frameworks. An Action originally gets its name from the HTML form tag's action attributes
A consolidated pattern for web frameworks is the MVC - where the action is the controller tier. Hence, often action and controller are used interchangeably.
Other MVC-based web framework require that your action objects extend or implement a base action class specific to that framework. Typically the action would have an execute() or perform() method that handles the end users request and send a response accordingly. Waffle, however is different than these other frameworks. An Action Controller in Waffle can be any java object (i.e. POJO). Additionally an Action Controller in Waffle can have many methods which are responsible for handling user requests. In Waffle these methods are considered ActionMethods.
Action Controllers and ActionMethods can be dependent on an HttpServletRequest, HttpServletResponse, HttpSession or ServletContext. In practice most Controllers you'll create will be dependent on custom Factories, Services, DAO's, etc. But if you have a need for these base Servlet classes it is nice to know that you can get access to them.
Digging deeper into how an Controller works we will continue with the ShoppingCartController class and add an accessor for a coupon field:
Now lets assume that the ShoppingCartController is requested with the following request string:
http://localhost:8080/waffle/shoppingCart.waffle?coupon=freebee
When Waffle's FrontController, WaffleServlet, handles this request it will first locate the appropriate controller by name "shoppingCart". Then Waffle will attempt to bind each parameter passed as a value to be set on the Controller. So "coupon=freebee" will set the field "coupon" on the controller to the value of "freebee". (Don't worry parameters that do not correspond to properties on an Controller will NOT cause a failure).
Lastly, controller classes do not have to end in the word 'Controller'. 'ShoppingCart' or 'Cart' are as good as 'ShoppingCartController' for Waffle.