1

Can someone explain the meaning and the position of a controller class in Java ? Why do we need to put the main method there ?

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614

2 Answers2

6

A controller class is normally a class part of the Model View Controller (MVC) pattern. A controller basically controls the flow of the data.

It controls the data flow into model object and updates the view whenever data changes.

I suggest you read about it:

Draken
  • 3,134
  • 13
  • 34
  • 54
Rabbit
  • 152
  • 2
  • 11
0

The java class which is responsible to handle request and response. it will return Model and view Object to DispatcherServlet. Model: Represents Data in Key Value format. View: Logical file name. Controllers: it is loosely coupled with Presentation technology.