什么是 ASP.NET/PHP 的主流 Java 替代品 [英] What is the main-stream Java alternative to ASP.NET / PHP

查看:25
本文介绍了什么是 ASP.NET/PHP 的主流 Java 替代品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说过一些使用 ASP.NET/PHP 构建的 Web 应用程序的例子,我想知道在 Java 世界中做类似事情的等效方法是什么.查看维基百科,我发现了很多框架,但我有点困惑哪个是最好的.

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.

推荐答案

Java 等效于 PHP经典"ASP 将是 JSP(JavaServer Pages) 带有 scriptlets(嵌入的原始 Java 代码).Scriptlets 被认为是糟糕的做法a> 在 Java Web 开发世界中.Taglibs 和 EL(表达式语言)应该优先于 scriptlets.ASP.NET (MVC) 将是一个 Java MVC 框架.有很多基于 Java 的 MVC 框架,主要提供了一个基于 Servlet/Filter 的控制器和标签库来与模型交互(通常是一个 Javabean)和视图(通常是 JSP 页面,但也可以使用 XHTML).

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).

首先,Java EE API 提供了JSF(JavaServer Faces) 用于此目的,它又伴随着基于 XHTML 的模板化视图技术,称为 Facelets.Facelets 被视为很好的旧 JSP 的替代品.此外,有许多开源 Java MVC 框架构建在 JSP/Servlet API,旨在作为 JSF 的替代/竞争.你可以在这里找到所有这些的很少信息,流行的是Spring MVC, Struts2条纹.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆