Business Logic Layerin Servlet and JSP

随声附和 提交于 2019-11-29 16:43:39

Yes, creating a separate Java project would be the way to go. Just a simple Java Project suffices. To use it in the dynamic web project, you should not only add it as a project in the Build Path. You also need to refer it as Java EE module in the dynamic web project. Eclipse will then take care about buiding and placing the JAR the right way.

If you're on Eclipse 3.5 or older, then check the Java EE Module Dependencies section in the properties of the dynamic web project. You should add the Java project there.

If you're on Eclipse 3.6 or newer, then check the Deployment Assembly section which does essentially the same (it has just been renamed/grouped with other functions as per 3.6).

It depends. IMO: Business Logic Layer means having all your business code separate from your presentation code. Normally this affects in terms of reuse.

It's not necessary to have all your business code in a separated project or jar. But in my short experience its interesting to do this if you are plannig to use this code in other applications than your web site (b.ex: webservices, desktop application or website designed for mobile acess).

I use Maven for building and resolving my project dependencies. But there are many others ways to acomplish this.

In Eclipse you could create two projects and deal with project dependency (Left click on your project -> Properties -> Java Build Path -> Projects tab).

Hope this will help you and sorry for my english.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!