what are JSP, Servlet , Bean in MVC ??


Web tier: servlets, JSP, Web frameworks: what are JSP, Servlet , Bean in MVC ??

  1. what are JSP, Servlet , Bean in MVC ?? (4 messages)

    can anybody explain me what exactly the roles of bean , jsp , servlet in Model View Controller Artchitechture.

    also i am confused to go ahead with implementing model 2 architecture. any resourses available on how to use JSP , servlets and beans together ??

  2. hello kumar
    firstly u need to know when we use jsp when use beans and when Servlets

    why use jsp.
               jsp is use 4 dynamic web creation it works same like Asp but it is greater pawerfull the Asp because we can use the java code directly in it.

    why use beans in Jsp
     we use beans foe server side intrection these are the fully resuable components with help of these we can access the database and other server side components

    why use Servlets
              Servlets are use 4 load balencing by the jsp we call theservlets 4 specific purpose.

              these three work side by side in best application

  3. Simpel: the bean is the model, JSP is the view and Servlet is the controller.

    The bean contains data and is stored via the session mechanism. Multiple Webpages (JSP/Servlets) can access and modify the bean (exactly like a model).

    A Webpage consist of a JSP an optionally a Servlet. The JSP reads the bean and displays it data (exactly like a view). When the resulting HTML page contains a HTML form, there should also be a Servlet to process this form an store the result in the bean again (exactly like a controller).

    Model2 is a good model to work by. The discussion point is the fact that links between webpages are hardcoded in the JSP/Servlet.

    JSP is called via URL
    JSP creates bean
    JSP is converted to HTML and displayed
    User clicks "post" button.
    HTML contains hardcoded link to Servlet.
    Servlet received post request.
    Servlet looks up bean in session object.
    Servlet interpretes HTML form and set bean properties.
    Servlet hardcoded calls another JSP...

    and so forth.

  4. In MVC architecture,
    M -MODEL is the component model
    can be a java bean, enterprise java bean or a CORBA component object in short any business model.
    V- VIEW
    The user's perspective whatever he sees VIEW of the MODEL
    can be a simple HTML page, can be a DHTML page,
    ASP page or JSP page.
    And the controller is your servlets.
    we very well know that every JSP is automatically translated abd compiled into Servlet.
    you have a bean model(business logic in a javabean or EJB) seen through JSP and controlled at the backend by the servlets.
    that's it..
    u can mail me for further clarifications..
    visa_lak at yahoo dot com
  5. Hi all,

    Can any one explain me what is the trade off involved in going in for a JSP to perform the controllers role, as compared to the traditional method of using a servlet as a controller.

    One point is, it is very very easy for the developer to develop the jsp pageg as compared to the servlet, and coding time is also going to go down on choosing jsp as a controller.

    Is there any real advantage to go in for a servlet to perform the controllers function ?

    What is not possible in a JSP controller that is possible in a Servler.

    I do agree that internally JSP is converted into a servlet but in the traditional MVC architecture why is a servlet given the controllers role ?

    Can any one throw some light on this ?

    D. Prashant.