aspose file tools*
The moose likes Struts and the fly likes Struts MVC  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts MVC  " Watch "Struts MVC  " New topic
Author

Struts MVC

Vijay Kumar
Ranch Hand

Joined: Jul 24, 2003
Posts: 260
hi all
as far as Struts is concern it is used to craetes MVC applications,
In this architecture thers is org.apache.struts.action.ActionForm.which is used to populate the javabeans on the server side with data entered from a form on the client side.My question is that in the MVC architecture,in which category it is placed.It can not be a controller or view.As for as the model is concern It is not implemting any business login.then in which category this ActionForm is placed.

thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
An ActionForm is tightly coupled with the JSP. For every input field in the JSP, you must have a correspoinding property in the ActionForm. Because of this tight coupling with the view, I'd call it a view helper object, which puts it in the category of the view.


Merrill
Consultant, Sima Solutions
Vijay Kumar
Ranch Hand

Joined: Jul 24, 2003
Posts: 260
thnaks Merril
I also think the same yet I have doubt because view is somthing through which we can display. And this Actionform is also tightly linked with model also see here


Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
An Action class is a controller object, not a model object. If an action class contains business logic, it's improperly coded. The Action's job is to instantiate and call methods on other objects which contain the business logic. Tight coupling is OK between the view and the controller, but not between the view and the model.

A view object doesn't have to display anything by itself. If it has logic that directly affects the display, it's still a view object. I see the ActionForm as a kind of extension of the Struts custom tags. For example, the tag:

<html:text property="title" />

operates by calling getTitle() and setTitle() on your ActionForm. The ActionForm is therefore highly instrumental in creating and displaying the view.
Vijay Kumar
Ranch Hand

Joined: Jul 24, 2003
Posts: 260
Ok Merrill
its mean model is used in Action based Classe. whcih perform some operations on models and get the retunrs to the view.
e.g.
LoginAction class which is extends by a Action class is a part of controller, received username & passwrod from the view say login.jsp and invoke an method on a Model class which will return whether it it is authorized user or not.And the result will be displayed to the view via ActionBased class.
please coreect me if I am wrong....

Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Yes, that's right.
 
 
subject: Struts MVC