I am reading about the DAO design pattern on Oracle’s website and I’m trying to understand the below image in the context of using JSP’s, Servlets, plain java objects, and the MVC pattern. In my case would the BusinessObject be my servlet and the TransferObject be my java class with only properties, mutators, and accessors (DTO)?
For example, if I had this code in a servlet (controller)
DTO.setFirstName(request.getParameter("firstName"));
DTO.setLastName(request.getParameter("lastName"));
DAO.save(DTO);

(source: sun.com)
Almost. Between the controller, which handles presentation logic, and the DAO, which handles Data access logic, there should be a business layer, containing the business objects.
The main responsibilities of these business objects are
This layer is very important because you want to be able to perform several operations on your database within a single transaction. And it should not be the responsibility of the web controller to handle this. Moreover, the same business services could be used by other clients than the web controllers (Swing client, batch, etc.)
Business objects are typically implemented using session EJBs, or Spring services.
They’re also useful to be able to