• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Struts and the core design patterns

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Are the web tire design patterns discussed in the 'Core J2EE Patterns' book implemented by Struts?

Regards,

Basel Mahdi
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think, Struts frame work is use
- Front Controller pattern
- View Helper pattern
- Dispatcher View pattern
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it also follow Command pattern by asking us to implement Action's execute method?
 
author & internet detective
Posts: 41986
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gayathri,
While the action has an execute method, it isn't really the command pattern. Take a look at this article for more details on the command pattern.
 
gayathri hariharan
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Jeanne,

Thanks for the article. It's been just a few months since i got into patterns and stuff.so please bare with me. This is the code i found in the article.



Just my guess that Struts processor class might look like code below.
But to me it appears that the code snippet in the article has more delegation than may be struts but otherwise it does look like command pattern to me.
I mean as per code below, may be the processor knows about the receiver but it still looks quite decoupled. So whether i save a html form or try to fetch some data, i still need not know what methods action class has. I just need to call execute on that method.

Looks like i'm missing something here.

 
Jeanne Boyarsky
author & internet detective
Posts: 41986
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gayathri,
The key with the command pattern is that you set the parameters as instance variables using setters. There is then a no-arg (zero argument) execute method.

If a Struts action looked like this, it would be the command pattern:
 
It sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic