什么是ASP.NET / PHP的主流Java替代品 [英] What is the main-stream Java alternative to ASP.NET / PHP
问题描述
我听说过一些东西,并且看到了一些使用ASP.NET / PHP构建的Web应用程序的例子,我想知道在Java世界中做类似的事情的方式是什么。在维基百科上看,我发现了很多框架,我很困惑哪一个是最好的。
Java相当于 PHP 和ClassicASP 将是 JSP(JavaServer Pages) (嵌入的原始Java代码)。 Scriptlets 被认为是糟糕的做法在Java Web开发世界中。 Taglibs和EL(表达式语言)应该优先于 scriptlets 。 Java相当于 ASP.NET (MVC)将是一个Java MVC框架。有很多基于Java的MVC框架,主要是提供一个基于Servlet / Filter的控制器和标签库来与模型交互(通常是 首先, Javabean )和视图(通常是一个JSP页面,但也可以使用XHTML) =http://java.sun.com/javaee/6/docs/tutorial/doc/ =noreferrer> Java EE API
至于选择哪一个,我建议看看这个答案,我非常同意。
I've heard something and seen some examples of web application built using ASP.NET / PHP and I'm wondering what would be the equivalent way of doing similar things in Java world. Looking on the Wikipedia I have found a lot of frameworks and I'm kind of confused which one is the best.
The Java equivalent of PHP and "Classic" ASP would be JSP (JavaServer Pages) with scriptlets (embedded raw Java code). Scriptlets are considered poor practice in Java web development world. Taglibs and EL (Expression Language) should be preferred above scriptlets. The Java equivalent of ASP.NET (MVC) would be a Java MVC framework. There are a lot of Java-based MVC frameworks out, mostly providing a Servlet/Filter-based controller and taglibs to interact with the model (usually a Javabean) and the view (usually a JSP page, but XHTML is also possible).
To start, the Java EE API provides JSF (JavaServer Faces) for this, which in turn comes along with XHTML based templated view technology known as Facelets. Facelets is seen as a replacement of the good old JSP. Further, there are a lot of open source Java MVC frameworks which are built on top of the JSP/Servlet API and which are intended as an alternative/competition to JSF. You can find little information of all of them here, the popular ones being Spring MVC, Struts2 and Stripes.
As to which one to choose, I suggest having a look at this answer which I strongly agree.
这篇关于什么是ASP.NET / PHP的主流Java替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!