SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
- user input some data. This data is collected by View.
- View passes that data to the Controller.
- Controller gives that data to the Model
- Model performs some calculation and send the result to the controller
- Controller sends the result to the View.
James Clarks wrote:
- View passes that data to the Controller.
In addition to passing the data, there is also some "action" or "behavior" which is invoked within the Controller. A user clicks on a Submit button, for example.
James Clarks wrote:
- Model performs some calculation and send the result to the controller
Yes, this is how it works. Keep in mind that the Model application shouldn't be invoking methods on the Controller. So, there is no need for a Controller reference in your Model.
SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
OK, let's say that a user clicks a Submit button. Can I invoke that action after clicking (in MVC concept)? :
OK, so keeping the reference to the View (instead of Controller) in the Model is a good option? After performing some calculations, model will notify the View to update.
SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Can I use enum as Action?
James Clarks wrote:
OK, let's say that a user clicks a Submit button. Can I invoke that action after clicking (in MVC concept)? :
The Model application does not have any reference to a Controller or a View.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
He does not suffer fools gladly. But this tiny ad does:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|