Developing small sample BookStore application and got a questions if someone explain to me please.
Using Model 2 architecture (MVC) pattern with JSP & Servlet. Hoping to add CDI dependency injection.
Sorry for the trouble.
1 – Naming convention.
In the screenshot. Is my folder structure and naming files is correct?
Ex:
I named my files like:
BookRepository.java implements IBook = Data access layer. Methods to add,update,remove etc
IBook.java = Interface for above methods.
Online tutorial I am following uses file names like
BookRepositoryImpl.java = CRUD methods implementation
BookRepository = Interface
Question: Is there any specific convention when we name the files in JavaEE?
How do you name you files and packages?

There isn’t any one and only true convention for naming those artifacts in Java EE.
It does however feels a bit strange if your entity/model is called
Book, and thatIBookis then an interface of a corresponding DAO/Repository. I would expect that to beIBookRepositoryinstead.I mentioned that there aren’t any real conventions regarding the terms, but having said that
ISomethingfor interfaces is not as common in Java as it’s in e.g. C#. Eclipse uses this convention and a few other projects also do, but it’s not that common.More common would be to use
BookRepositoryfor the interface and thenSomeTechBookRepositoryfor the implementation, where “SomeTech” could be e.g. “JPA” or “JDBC”. Also consider the termDAOinstead ofRepository.Another recent trend in Java EE is to forego the interface for the repository/dao if you don’t really need it yet (this topic is debatable). If you used the naming convention
BookDAOfor the implementation class and don’t have an interface, then it’s relatively easy later on to makeBookDAOthe interface and add e.g. aJPABookDAO.Finally a JSP / Servlet based approach is a bit out of date these days in Java EE. Java EE comes with a MVC framework out of the box (JSF) and support for Services/DAOs (EJB) and persistence (JPA). For a CRUD example of these technologies see: http://jdevelopment.nl/sample-crud-app-with-jsf-and-richfaces