File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Difference between a Command object and a Model object? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Difference between a Command object and a Model object?" Watch "Difference between a Command object and a Model object?" New topic
Author

Difference between a Command object and a Model object?

nilu chan
Greenhorn

Joined: Aug 31, 2010
Posts: 17
I am new to spring and tyring to understand the difference between Command object and a Model object in spring mvc.

A Bean that stores user input (usually entered through html forms) is called the Command object.
An object that gets returned to the user which can be used further for displaying data is called Model object.

Please correct me if I am wrong. Any pointers or links are also welcomed.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3858

Model may not be returned to the user rather it's used to construct the response including preparation of the view to the user.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
john christopher
Greenhorn

Joined: Jul 28, 2011
Posts: 2
The ADO Command object is used to execute a single query against a database. The query can perform actions like creating, adding, retrieving, deleting or updating records.

If the query is used to retrieve data, the data will be returned as a RecordSet object. This means that the retrieved data can be manipulated by properties, collections, methods, and events of the Recordset object.

The major feature of the Command object is the ability to use stored queries and procedures with parameters.
ProgID
set objCommand=Server.CreateObject("ADODB.command")

Command object is used to submit and execute a specific (single) query against a database. The query can command a variety of actions, such as adding, creating, deleting, retrieving, or updating databases (record sets).

The term Model Object is an informal term, with no widely accepted definition. Here, Model Objects (MOs) refer to data-centric classes which encapsulate closely related items.

Model Objects :

are very common, and are used in almost all applications
are often central to an application, since they usually model problem domain objects
often map roughly to the records of a corresponding database table
are often used as return values for Data Access Object methods
are easily tested using JUnit (or a similar tool)
can be used to implement the Model in a Model-View-Controller pattern

Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3858

Welcome to CodeRanch, John Christopher!
By ADO I guess you are talking about this which are used with ASP?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between a Command object and a Model object?