开发者

Can I use multiple frameworks for my Java Enterprise project?

This question just flows through my mind and I hope you here can tell me how.

And since each framework extends the servlets, so I wonder how to share data across them such as I insert an Integer into Session using Struts, can I get that 开发者_如何学CInteger in SpringMVC or Seam.


I have mixed feeling on this one. Most framework do rely one way or the other on a front-controller, that is, a servlet than intercepts the requests to various URL and dispatch the processing. You could maybe configure each framework to intercept different URL (e.g. /faces/* for JSF, /actions/* for Struts) to avoid clashes and make them coexist.

They are all based on the Servlet API, so you could maybe forward the processing of request from one framework to another using the Servlet API or access whatever is stored in the request using the Servlet API, but that sounds rather tricky to me, plus I don't see exactly the need to combine two frameworks.


Well, frameworks like Struts, Spring MVC, JSF can technically coexist and one could use the application context, the session or even the request depending on the situation to share things between them.

But IMO the real question is why would you do that? Why multiplying configuration files, why loading classes from overlapping frameworks, why making things more complicated and harder to maintain? People usually don't do that, they pick one solution and use it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜