• 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

Design pattern used in Struts Framework ?

 
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What design pattern does Struts framework follow ?

Is it Inversion of Control ???

If yes, how does inversion of control happen in struts ?

I have heard that this concept is used in Spring but not sure if it is in struts.

Thanks.
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jose chiramal wrote:What design pattern does Struts framework follow ?



Struts controller uses the Command design pattern and the action classes use the Adapter design pattern. The process() method of the RequestProcessor uses the Template method design pattern. Struts also implement the following J2EE design patterns.

* Service to Worker
* Dispatcher View
* Composite View (Struts Tiles)
* Front Controller
* View Helper
* Synchronizer Token


Is it Inversion of Control ???

If yes, how does inversion of control happen in struts ?

I have heard that this concept is used in Spring but not sure if it is in struts.



Struts2 is based on WebWork which has IoC. Struts2 supports interface injection (IOC).
 
Ranch Hand
Posts: 110
Firefox Browser MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

What design pattern does Struts framework follow ?


Struts follows MVC architecture and uses Front Controller design pattern.
Which version of Struts are you using?
Struts 2 uses Inversion of Control (IoC) pattern also known as dependency injection.

If yes, how does inversion of control happen in struts ?


In Struts 2 action class the HTTPServletRequest object can be obtained using IoC pattern

I have heard that this concept is used in Spring but not sure if it is in struts.


Yes Spring uses IoC pattern. Strus2 also uses Ioc pattern. I am not sure about Struts 1.x
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For Struts 1 it depends on which version, but the concept is relatively limited (as it was with most Java code back in those days). Struts 1 did integrate with Spring, however, allowing some injection, and it was possible to identify which implementation classes to use for various things (like custom request processors) in the Struts configuration file (again depending on version). So I'd say yes, Struts 1 supported IoC, but in a limited way.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic