wood burning stoves 2.0*
The moose likes Struts and the fly likes Pattern used by action class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Pattern used by action class?" Watch "Pattern used by action class?" New topic

Pattern used by action class?

Chandra shekar M
Ranch Hand

Joined: Dec 20, 2006
Posts: 135

In struts 1.x the execute(ActionForm form,ActionMapping map,Htt...) as this signature. When the request is originated the struts framework will use reflectionAPI concept and populate the form bean then the request if forwarded to Action class for processing now the execute method has form bean object passed. Passing of the form object is it based on command pattern? or any other pattern?

I guess its Command pattern; similar functionality is provided by the spring where we actually set the command object(formbean) using setCommand(ActionForm). Please correct me if i am wrong.

Chandra shekar M
Ranch Hand

Joined: Dec 20, 2006
Posts: 135
Any updates on this.

Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Well, first thing is where does the Action class fit in M'VC' pattern, which is always debatable and out of scope for now.
To me, Undoubtedly ActionServlet is front controller pattern.
If you say that "Action Class" is part of Controller then,
To me, I see Struts Action class to follow more of "Service to Worker pattern" wherein using "struts-config" is "Command pattern" and using Tiles is "Composite View pattern". This is due to action class which does little bit more to call the business layer (if any) and other business logic for validations etc.
If you say that Actions is part of View then,
To me, I see Struts Action class to follow more of "Dispatching View pattern". Since here, action class is still responsible to receive the request and process it provide the response with less amount of business logic processing.

Again, this is my perspective any objections are welcomed

Have Fun with Java
little,little.. little by little makes a lot..
wood burning stoves
subject: Pattern used by action class?
Similar Threads
Architecturally correct and the best way to access EJB from a JSP client(urgent!!)
ActionForm (Context Object Or Command pattern?)
Domain Object as Strtus Action form.
Action Form Problem
Command & Context Object pattern