In Struts What is Model?
This tutorial explains you What is Model in Struts. Struts is MVC based application and it is separated into three integral parts, Model, View and Controller.
In MVC design pattern there are three kinds of components:
Struts is also based on the MVC design patter and Model plays important role in the framework. In any MVC framework model is the component responsible for the handling the data of the system. In MVC there is no requirement of containing the model itself, instead it contains the links to the one or more Models.
In Struts framework you can create the variables in Action to hold the data of the application. In the Action class itself you can call the methods of application service to retrieve and save the data into database.
Thus in Struts Action class plays an important role of managing the data (Model) of the application. So, its advisable to create the intelligent code in your action class and don't write the JDBC code in Action class. You should always use the Service classes to access the database.
Struts Framework Tutorials:
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: January 14, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles