带有Spring MVC的JSF组件库 [英] Jsf component libraries with Spring MVC
问题描述
我可以将jsf组件库(primefaces)与spring mvc一起使用吗?我在客户端开发方面遇到问题,所以我想要一种创建用户界面的简单方法.而且我不喜欢jsf生命周期.我需要一种使用组件库的方法
Can I use jsf component libraries(primefaces) with spring mvc .I have problem with client side development so i want a simple way of creating user interfaces .And I dont like jsf life cycle .I need a way of using component libraries.
推荐答案
JSF和Spring MVC具有完全不同的意识形态.一个是基于组件的MVC框架,另一个是基于请求的MVC框架.混合这没有任何意义.通常,您可以选择其中一个.基于组件的MVC框架的优势在于,它最小化了HTML/CSS/JS样板代码和服务器端请求处理,但是这带来了缺点,即您无法对生成的HTML/CSS/JS和服务器端请求处理.为此,您需要一个基于请求的MVC框架.但这又有一个缺点,那就是您需要编写所有HTML/CSS/JS样板文件和服务器端要求自己处理的文件.
JSF and Spring MVC have completely different ideologies. The one is a component based MVC framework and the other is a request based MVC framework. Mixing this makes no sense. You normally choose the one or the other. A component based MVC framework has the advantage that it minimizes the HTML/CSS/JS boilerplate code and the server side request processing, but this brings the disadvantage back that you don't have fine grained control over the generated HTML/CSS/JS and the server side request processing. For that you'd need a request based MVC framework. But this has in turn the disadvantage that you need to write all that HTML/CSS/JS boilerplate and server side request processing yourself.
如果您想坚持使用Spring MVC并想要一个丰富的UI,我建议您看一下基于JavaScript的UI库,例如jQuery UI.
If you want to stick to Spring MVC and want a rich UI, I suggest to look at a JavaScript based UI library, such as jQuery UI.