9

Struts, Spring and a few other frameworks implement the MVC architecture to separate the representation of information from the user's interaction with it.

Can any one explain or give me a link for that in Java EE?

Without using a framework, how can I create an MVC application and what are the design patterns needed for that?

Mike Braun
  • 3,729
  • 17
  • 15
Murali
  • 319
  • 2
  • 5
  • 9
  • Reading this [**thread**](http://stackoverflow.com/questions/2575471/how-to-develop-jsp-servlets-web-app-using-mvc-pattern) and this [**link**](http://www.javatpoint.com/MVC-in-jsp) might help you. – Surinder ツ Aug 21 '13 at 09:52

6 Answers6

7

Take a look at this presentation, which is part of Beginning & Intermediate Servlet & JSP Tutorials on http://www.coreservlets.com/

jeroen_de_schutter
  • 1,843
  • 1
  • 18
  • 21
3

you can use Servlet and Jsp to create a MVC application without using any framework,

here are some useful links, http://forum.codecall.net/topic/72183-mvc-application-in-java/

another useful example,

http://css.dzone.com/articles/web-mvc-java

Bilbo Baggins
  • 2,899
  • 10
  • 52
  • 77
3

I think this is a good tutorial on Creating MVC architecture with servlets and jsp

The main concern in creating MVC architecture is the separation of concerns. You need to separate business layer, presentation layer and controler layer

  • Model layer is achieved by simple POJO
  • View layer i.e. Presentation layer can be achieved by JSP
  • Controllers can be achieved by servlets in java ee
Prasad Kharkar
  • 13,410
  • 5
  • 37
  • 56
1

You can use Servlets and JSP directly. For managing Java EE applications we are using design patterns.

MVC-1 and MVC-2 are design patterns for managing the UI layer. Struts and Spring-MVC are implementations of the MVC-2 design pattern.

Mike Braun
  • 3,729
  • 17
  • 15
1

MVC stands for Model View and Controller. It is a design pattern that separates the business logic, presentation logic and data.

  • Controller acts as an interface between View and Model. Controller intercepts all the requests.
  • Model represents the state of the application i.e. data.
  • View represents the presentaion.

This link contains an example to implement it with JSP and Servelet.

Ankur Lathi
  • 7,636
  • 5
  • 37
  • 49
0

To answer you first question: the part of the Java EE framework that implements MVC is called JSF. This provides templates, graphical components (widgets) and much more.

To answer your second question: you don't really build an MVC app without any framework. You may be using Servlets and JSP, but that too is a framework. Java EE in its entirety is a (full stack) framework as well.

As for the third question: this is simple, the design pattern to use for MVC is MVC.

Mike Braun
  • 3,729
  • 17
  • 15