• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts MVC

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, that's right.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic