简体   繁体   English

什么是Java EE中的Web组件?

[英]What is a web component in Java EE?

What does term 'web component' mean in Java EE? 术语“Web组件”在Java EE中的含义是什么? Give me some examples from different Java EE technologies (jsp, jsf, ejb..) 给我一些来自不同Java EE技术的例子(jsp,jsf,ejb ..)

UPD: can I say that every custom tag in jsp is a web component and that tags in jsf are web components? UPD:我可以说jsp中的每个自定义标签都是一个Web组件,而jsf中的标签是Web组件吗? or only servlets and whole jsp-pages are web components? 或者只有servlet和整个jsp页面是Web组件? is deployed session bean a web component? 会话bean是一个Web组件吗?

A Web component is nothing more than a software component that services an incoming HTTP request and provides some kind of (hopefully valid) response. Web组件只不过是一个软件组件,它为传​​入的HTTP请求提供服务并提供某种(希望是有效的)响应。

Most if not all Java Web frameworks are built upon the core Java servlets technology. 大多数(如果不是全部)Java Web框架都是基于核心Java servlet技术构建的。 A servlet is a persistent piece of code that receives an abstraction of an HTTP request and gives an HTTP response. servlet是一段持久的代码,它接收HTTP请求的抽象并提供HTTP响应。 I say "persistent" because it generally is long-lived over many connections (unlike the older CGI based transient processes that were around 10-15 years ago when servlets were dreamed up). 我说“持久”是因为它通常在很多连接上都存在很长时间(不同于大约10 - 15年前基于CGI的瞬态过程,当时servlet被设想了)。

In addition the servlets specification includes: 此外,servlet规范包括:

  • Hooks for creating and destroying servlets; 用于创建和销毁servlet的钩子;
  • Automatic session management including in clustered environments; 自动会话管理,包括在集群环境中;
  • Output in the response uses the standard Java I/O library; 响应中的输出使用标准Java I / O库;
  • Servlets have fairly complete abstractions for the request and response; Servlet对请求和响应有相当完整的抽象;
  • Application-level (persistent) configuration is supported; 支持应用程序级(持久)配置; and
  • Data can be scoped in different ways (page, request, session and application). 数据的范围可以采用不同的方式(页面,请求,会话和应用程序)。

A JSP is a special kind of markup that a JSP-capable Web container will "compile" into servlet code. JSP是一种特殊的标记,具有JSP功能的Web容器将“编译”为servlet代码。

Struts (1 & 2), Spring MVC, JSF, Seam, Wicket, Tapestry, etc are all Web frameworks that are built up on top of the servlets specification. Struts(1和2),Spring MVC,JSF,Seam,Wicket,Tapestry等都是基于servlet规范构建的Web框架。 There are literally dozens of these and they are all different. 实际上有几十种这些都是不同的。

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

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