I am currently developing a simple web application that would apply the MVC architecture. To those new to the MVC term, it stands for Model-View-Controller. An architecture used for simple applications that separates the GUI pages (for end client), the business logic (reusable classes), and the controller (that controls the event or method call). You can easily implement this in Eclipse by creating a new Dynamic Web Application project.
Apparently, during the development process, I’ve encountered a simple yet very important problem. My Database related classes can’t locate the classes from Postgre (which is my database system). This is due to the Library from Postgre that my code is looking.
The big question now – “How will I add a library in my Dynamic Web Project?”
Well, in a simple Java Project, this is easy but for a project of this kind where your sources are placed in a separate directory scheme it is the other way around.
I found this thread and it worked:
The solution is quite straightforward:
– Right click on the your web project and choose PROPERTIES
– Choose the J2EE Module Dependencies
– Click on the Add External JARs… and then point on your library file (ZIP or JAR)
– Click on Apply then OK.
– Restart your Apache Tomcat
The added library should be seen under: ProjectName > Java Resources: src > Libraries > WebApp Libraries.