开发者

Move servlets to jar file in purpose to use as library

As I know it's rule to locate servlets in webapplication module. So after packaging we'll have war archive. But later I need servlets to use like library. So as we cannot use war file as library i need the jar.

The question: is it normall to refactor webmodule so that move servlets to oth开发者_Go百科er project(module) to package to jar archive and use it in webapp as dependency while compiling ?


It's pretty rare to have general purpose, reusable servlets (except if you're developing a framework). But if you have one, putting it in a jar to make it reusable by several webapps is the way to go.


It's not normal (or, indeed, recommended) to package servlets in a jar or to use them as "libraries". What you are supposed to do is extract and isolate any business-logic that is "common" and should be usable by others than the servlet. Those classes can then be packed in a jar that is included in the webapp war as well as any other clients/modules you have that need them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜