I have a Java web application built using Spring MVC. I have a set of JSPs which are the pages, and a set of "model" objects which are sent to the JSPs to populate/receive the form data. Here is a simplified view from the JSP down to the database layer:
showCustomer.jsp // JSP page using the "CustomerViewDao"
org.mycompany.views.CustomerViewDao // view backing (model) object
org.mycompany.controller.CustomerController // controller layer
org.mycompany.service.CustomerService // service layer
org.mycompany.model.Customer // Hibernate entity
Is there an accepted naming convention for these model objects? I chose "xxxDao" for "Data Access Object" and was told this was not a "good" choice. Is there a better choice and what would it be?
Firstly, there is no "accepted naming convention". However, some people have good ideas about these things ... eg trawl through the answers to this: What naming convention do you use for the service layer in a Spring MVC application?
For what it is worth, I probably would have chosen xxxDao
too ... assuming that the object really is a DAO. But obviously, your reviewer had different ideas. You should ask him (or her) for suggestions ... not us! (What is to say that he won't arbitrarily reject your next N choices as being "not good"?)
On the other hand, he might have rejected your choice of "xxxDAO" because the object / class is not a DAO (Data Access Object) in the normal sense of that term. Your description ... "view-backed (model) object" ... does not really match the normal usage of DAO.
我曾称它为:ShowCustomerBean
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.