Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a web component in Java EE?

What does term 'web component' mean in Java EE? Give me some examples from different Java EE technologies (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? or only servlets and whole jsp-pages are web components? is deployed session bean a web component?

like image 943
Roman Avatar asked Nov 03 '09 14:11

Roman


1 Answers

A Web component is nothing more than a software component that services an incoming HTTP request and provides some kind of (hopefully valid) response.

Most if not all Java Web frameworks are built upon the core Java servlets technology. A servlet is a persistent piece of code that receives an abstraction of an HTTP request and gives an HTTP response. 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).

In addition the servlets specification includes:

  • Hooks for creating and destroying servlets;
  • Automatic session management including in clustered environments;
  • Output in the response uses the standard Java I/O library;
  • Servlets have fairly complete abstractions for the request and response;
  • 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.

Struts (1 & 2), Spring MVC, JSF, Seam, Wicket, Tapestry, etc are all Web frameworks that are built up on top of the servlets specification. There are literally dozens of these and they are all different.

like image 141
cletus Avatar answered Oct 22 '22 06:10

cletus