The MVC Model with Servlets and JSPs


In the J2EE model, servlets and JSPs fit well into the MVC model when coupled with Enterprise Java Beans (EJBs). Briefly, EJBs are commonly used as a representation of business logic and/or data in a database or other backing store. EJBs fill the model role. They traditionally map very closely to the underlying business logic or database.

JSPs, on the other hand, are made to generate output. Recall from Chapter 18, "JavaServer Pages and Tag Libraries," that, while JSPs default to generating HTML output, they can actually generate any type of output such as WML (Wireless Markup Language) or XML. They fit well into the view portion of the MVC pattern.

The controller portion of the MVC model is implemented with servlets. The servlet gets input from the front end device (again, a browser, PDA, Web service, and so on) and processes this data to modify the model in some way. To complete the circuit the servlet redirects to a JSP to do the rendering. The JSP can get any information that it needs from the model.



BEA WebLogic Platform 7
BEA WebLogic Platform 7
ISBN: 0789727129
EAN: 2147483647
Year: 2003
Pages: 360

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net