Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

MVC, Desktop application, where create POJO object?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I have a problem where should I create my domain model object, (such as Customer, Order, etc...)
I am creating a standalone app for my homework and I am not sure where to create that kind of object.

For example I have a gui form for registering new customer.
And now where I should create Customer object in view, and than send it to controller,
validate properties of the object, next send it to model to store it in db??

Maybe it's a controller function to create an object after getting values from view?

My point is that every examples of mvc are working on simply values such as int, string etc, but what about pojo object?

Could anybody help me?

Regards







 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Model application is a separate component which communicates with the Controller. The Controller does not create any business/domain model objects. The Controller simply passes information between the Model and the View components.

So, once the data is entered by the human using the View. This data is passed to Model application by Controller. When the Model application receives the data and the request to "do something" with the data, the Model object (POJO) is created in the Model application/component.
 
Marek Kisiel
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for answer.

So if user want to save new customer in db for example, can I use HashMap to send all p values from customer form per once to controller, and next to model?

 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your View is a Swing or AWT-based application, then yes, you could use a Map object to send data to Controller.

If your View is browser-based HTML, then no. Data is sent from an HTML Form via HTTP in name/value pairs in the HttpRequest object.

Learn more about Transfer Object design pattern.
 
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic