ajsie
ajsie

Reputation: 79836

jsp, servlets, faces and beans?

i´ve read a little about java's structure and could someone tell me if my view of all these components are correct:

JSP corresponds a View
Servlet corresponds a Controller
Bean corresponds a Model
Faces correspond layouts to render display

is this roughly correct?

Upvotes: 0

Views: 461

Answers (2)

BalusC
BalusC

Reputation: 1109715

Yes, you're roughly correct.

Only, the Faces is more than just "layouts to render a display". JSF is a full fledged component based MVC framework which is built on top of the Servlet API. It uses the FacesServlet as the sole controller. It used to use JSP as view technology, which is now replaced by Facelets (XHTML) as per the new JSF 2.0 API. It uses the so-called backing beans as model. Then, you have taglibs/components which can be used in the view layer to generate HTML and uses Expression Language to associate the data/events with the model objects (the managed beans).

Upvotes: 1

Nate
Nate

Reputation: 16898

JSPs are view technology - HTML with Java embedded in it. Servlets should be used as controllers - they're Java classes that implement methods to read and write HTTP streams. In a web app Javabeans are usually the model - JSPs and other Java view technologies understand how to access properties of Javabeans, bind them to forms, etc. Faces is a separate stack JSF (Java Server Faces) is a component based web framework.

Upvotes: 2

Related Questions