Can someone explain the meaning and the position of a controller class in Java ? Why do we need to put the main method there ?
Asked
Active
Viewed 2.5k times
1
-
3Can you elaborate more in question ? which controller do you mean here ? – Saurabh Oza Oct 29 '18 at 13:15
-
2Can you provide some more context? Where is the term "controller class" mentioned? – Henry Oct 29 '18 at 13:19
-
Are you sure that you're not mixing this up with the MVC design pattern commonly used in Web Development? – EJoshuaS - Stand with Ukraine Oct 29 '18 at 13:49
2 Answers
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:
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.