JaiswalTraining

Get the online training



Corejava Servlet Jsp  Php  Hibernate  Ajax Web Service   Ejb2.1 Ejb3.0 Struts Struts2  JPA Spring Ibatis   JSF    JSF2.0  CoreJavaDesignPattern    Jquery  Flex J2EE-Design-Patterns  Jboss7  Maven  Contact Me                                                                                                                                                                        
            IGNOU SMU PTU Project                                           Training                                                                                                                              
              

Contact Us  0091- 9210721663         jaiswaltraining@gmail.com




Corejava
Servlet
Jsp
Php
Hibernate
Ajax
Web Service
Ejb2.1
Ejb3.0
Struts  
Struts2
JPA
Spring
Ibatis
JSF
JSF2.0
CoreJavaDesignPattern
Jquery
Flex
J2EE-Design-Patterns
Jboss7
Maven







Service to Worker Pattern
  • Context
    • A Web based system that generates presentation content(view) based on a
      template and a dynamic model.
    • The system controls flow of execution and access to business data, from which it
      creates presentation content.
Problem

  • Problem is the combination of the problems solved by the Front Controller and View
    Helper Patterns.
  • The system does not have a centralized request handling mechanism for managing the
    application services for each request.
    • Business and formatting logic is embedded directly within the view. This makes the system less flexible, less reusable and less resilient to change.
    • Mixing the business and system logic with the view reduces modularity and provides a poor separation of roles among team members.
Forces
  • Authentication and authorization checks are completed per request
  • Scriptlet code within views should be minimized
  • Business logic should be encapsulated in components other than the view
  • Control flow is relatively complex and based on values from dynamic content
  • Multiple views are commonly used for responding to the similar business
    requests.
Solution

  • Combine the Front Controller and View Helper patterns to move some presentation logic
    forward into the controller and application logic back into Helpers.
  • A Front Controller is the initial point of contact for the request and is responsible for
    managing many aspects of request handling
    • System services such as authentication and authorization
    • Delegation of business processing, choosing an appropriate view, selection of content-creation strategies.
    • Preparing the model for use by the view , which it dispatches



Participants

  • Client
    • Object requesting the generation of the view
  • Controller
    • Initial point of contact for handling a request
  • Dispatcher
    • Responsible for view management and navigation
    • Manages the choice of the next view to be presented to the user
    • Can be encapsulated within the controller
  • View
    • Represents and displays information to the client
  • Helper
    • Responsible for helping a view or controller complete its processing.
    • Responsible for gathering data required by view and storing this intermediate model.
  • ValueBean
    • Another name for the helper
    • Responsible for holding intermediate model state for use by a view.
  • Business Service
    • Role that is fulfilled by the service the client is seeking to access.
    • Accessed via a business delegate



Strategies
  • Servlet Front Strategy
    • The Front Controller is implemented as a servlet.
    • This is the preferred to the JSP Front Strategy.
  • JSP Front Strategy
    • The Front Controller is implemented as a JSP Page
  • JSP View Strategy
    • The view component is implemented as a JSP page
    • Preferred strategy
  • Servlet View Strategy
    • The view component is implemented as a Servlet
  • JavaBean Helper Strategy
    • Helper is implemented as a JavaBean
    • JavaBeans are easily constructed and integrated into a JSP environment
  • Custom Tag Helper Strategy
    • The Helper is implemented as a custom tag (JSP 1.1 onwards only)
Consequences
  • Centralized control
  • Improves Modularity and Reuse
  • Improves Application Partitioning
  • Improves Role Separation

Related Patterns
  • Front Controller and View Helper
    • The Service to Worker pattern is the result of combining the View Helper pattern
      with a dispatcher, in coordination with the Front Controller pattern.
  • Dispatcher View
    • Another name for the combination of the Front Controller pattern with a dispatcher,
      and the View Helper pattern.