简体   繁体   English

JSF和Spring性能与糟糕的JSP性能相比

[英]JSF and Spring performance vs poor JSP performance

I saw some JSF projects developed by my collegues and these projects seemed to me very slow. 我看到我的同事开发的一些JSF项目,这些项目在我看来非常慢。 Does anybody have the same opinion? 有没有人有相同的意见?

I'm currently using jsp+jstl and jQuery for "rich" client. 我目前正在为“富”客户端使用jsp + jstl和jQuery。

I wonder what advantages and disadvantages have modern frameworks (jsf, wicket, tapestry..) over old plain jsp. 我想知道现代框架(jsf,wicket,tapestry ......)优于旧普通jsp的优点和缺点。

It would be great if people who used all these technologies had answered. 如果使用所有这些技术的人都回答了会很棒。

It's also interesting for me which most exciting features made you to leave jsp and use "massive" framework (I mean, for example AOP in Spring or something else whatever you can notice). 这对我来说也很有趣,最令人兴奋的功能让你离开jsp并使用“大规模”框架(我的意思是,例如Spring中的AOP或其他任何你能注意到的东西)。

Thanks for all comments. 感谢所有评论。

I've used CGI, PHP, JSP, Struts, Spring MVC (1.2), Bea workshop, JSF, JBoss Seam, Spring MVC (2.5) and Wicket (in that order). 我使用过CGI,PHP,JSP,Struts,Spring MVC(1.2),Bea workshop,JSF,JBoss Seam,Spring MVC(2.5)和Wicket (按顺序)。 I've noticed a jump in both productivity and quality for each new technology I've worked on. 我注意到我所研究的每项新技术的生产力和质量都有所提高。 It just works better, It feels better. 它只是效果更好, 感觉更好。 I prefer Wicket (with a twist of spring, quartz, etc.) over all of the others. 我比其他所有人更喜欢Wicket(带有扭曲的弹簧,石英等)。 I can honestly say I saw the light, and I don't want to go back to a darker -- or lighter ;) -- side. 我可以诚实地说,我看到了光,我不想再回到更黑暗 - 或更轻的; - 一边。

There is a lot to say about Wicket. 关于Wicket有很多话要说。

  • Conversational support (or tab-enabling) comes by default, you do not worry about "open in a new tab" and "back" button problems ever again. 默认情况下会话支持(或启用标签),您不必再担心“在新标签页中打开”和“返回”按钮问题。
  • It is component-based, so you can re-use code ala swing. 它是基于组件的,因此您可以重新使用代码ala swing。
  • Leverages a lot of the standard Java, like the type safety wonders. 利用许多标准Java,如类型安全奇迹。
  • Supports advanced security features like url encryption. 支持网址加密等高级安全功能。
  • Clusterizable applications by default. 默认情况下可集群化的应用
  • And, most important, it is fun to use. 而且,最重要的是,使用起来很有趣

There is a lot to improve for JSP and JSF. JSP和JSF有很多需要改进的地方。

  • The one thing that bothers me the most is the "EL" nonsense, for I believe it breaks the nice java type safety and strength. 困扰我的一件事是“EL”废话,因为我相信它打破了java类型的安全性和强度。
  • Both need tooling support for high productivity. 两者都需要工具支持以实现高生产率。
  • You need another framework on top of both of them to really solve the problems (as seen with seam framework, which makes JSF usable). 你需要在它们之上的另一个框架来真正解决问题(如使用seam框架看到的那样,这使得JSF可用)。
  • The error handling is very tricky and the exceptions are not straitforward helpful. 错误处理非常棘手,例外并不是非常有用的。
  • It is difficult to make reusable components on both frameworks and doesn't support a proper model for separation of concerns. 很难在两个框架上制作可重用的组件,并且不支持用于分离关注点的适当模型。
  • ... and, most important, a long etc of minor pains, like this , or this . ...而且,最重要的是,很长一段时间的轻微痛苦,像这样或者这样

I totally like to use JSP 2.0 as templating technology -- that is I use Spring MVC to access my domain objects and prepare all data I need for a certain view and leave it to JSP to render it. 我完全喜欢使用JSP 2.0作为模板技术 - 我使用Spring MVC来访问我的域对象并准备我需要的某些视图的所有数据,并将其留给JSP来呈现它。 JSP 2.0 because I like to use tag files for template composition which allows me to use simple JSP 2.0 where I would need other compositing frameworks else. JSP 2.0,因为我喜欢使用标记文件进行模板合成,这使我可以使用简单的JSP 2.0,其他地方需要其他合成框架。

I intentionally avoid everything in JSP that basically is programming. 我故意避免JSP中基本上是编程的一切。 No data acess, no SQL, no scriptlets, no methods, no nothing. 没有数据访问,没有SQL,没有scriptlet,没有方法,没有任何东西。 just plain presentation of pre-existing, controller-provided data with maybe some simple cases and iteration of collections. 只是通过一些简单的案例和集合的迭代,简单地呈现预先存在的,控制器提供的数据。

Many advantages. 许多优点。 I can enumerate JSF advantages which are those I've used in my last project. 我可以枚举JSF的优点,这些优点是我在上一个项目中使用的优点。

  • Centralized place for the navigation (like in struts) 导航的集中位置(如struts)
  • Components like a date-picker, auto-completion, paging, etc. 日期选择器,自动完成,分页等组件。
  • You have renders for the layout which facilitates a lot some layout logic. 你有布局的渲染,这有利于很多布局逻辑。
  • Availability of tiles, like in struts. 瓷砖的可用性,如支柱。

JSP doesn't make a clear separation between business logic and layout. JSP没有明确区分业务逻辑和布局。

Anyway, although all this advantages and if you are a Java programmer I would advice to take alook at Grails which is pretty much more comfortable. 无论如何,虽然所有这些优点,如果你是一个Java程序员,我建议你参加Grails ,这是非常舒服的。

JSP is extremely primitive, you basically have no widgets and have to build everything yourself. JSP非常原始,你基本上没有小部件,必须自己构建一切。 JSF while an improvement is not the best web framework for java - there are plenty of others that enable you to achieve a much more impressive result - eg GWT. JSF虽然改进不是java的最佳Web框架 - 还有很多其他的东西可以让你获得更令人印象深刻的结果 - 例如GWT。

Benefits of Spring MVC: Spring MVC的好处:

  • The framework subtly encourages you to write better designed code: by using dependency injection, and splitting up your application design into domain (model) objects, controllers, service classes, DAOs, etc. 该框架巧妙地鼓励您编写设计更好的代码:使用依赖注入,并将应用程序设计拆分为域(模型)对象,控制器,服务类,DAO等。
  • As a side effect of the first bullet point, your code ends up being extremely and easily unit-testable. 作为第一个要点的副作用,您的代码最终会非常容易地进行单元测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM