Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
960 views
in Technique[技术] by (71.8m points)

eclipse - Business Logic Layerin Servlet and JSP

Recently I started to move from a .NET platform to J2EE. I'm Eclipse to build JSP and Servlet applications which should use Business Logic layer.

The approach in .NET is very simple I'm building web Application Project inside the solution, then Creating Class Library project and refers its output in Web Application References.

How should I do it in Eclipse? Should I create separate project and build JAR file as output and refer it in Web Project?

I'm new to Java so any comment will be more then welcomed.

Danny.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

alt text

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).

alt text


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...