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







View Helper Pattern
  • Context
    • The system creates presentation content, which requires processing of dynamic
      business data.
Problem

  • Changes occur often in the presentation tier and are difficult to manage when
    business logic and presentation logic are interwoven.
  • This makes systems
    • Less flexible
    • Less reusable
    • Less resilient
  • Reduces modularity
Forces
  • Business data assimilation requirements are nontrivial.
    • Embedding business logic in the view causes maintenance problems.
    • It is desirable to promote a clean separation of labor by having different roles of
      Software developer and Web production team member
    • One view is used to respond to a particular business request.
Solution

  • A view contains only the formatting code
  • Business processing responsibilities are delegated to helper classes
    implemented as JavaBeans or custom tags.
  • Helpers store the view’s intermediate data model



Participants

  • Client
    • Object requesting generation of the view.
  • View
    • Represents and displays information to the client.
    • Information that is used in a dynamic display is retrieved from a model.
    • Helpers support views by encapsulating and adapting a model for use in display.
  • Helper
    • Responsible for helping a view or controller complete its processing.
    • Responsible for gathering data required by view and storing this intermediate model.
    • Also referred to as ValueBean sometimes.
    • Typically implemented as JavaBeans and custom tags.
  • 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.
    • Service is accessed via a Business delegate.
    • Role of Business delegate is to provide control and protection for the business service.



Strategies
  • 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)
  • Business Delegate Helper Strategy
    • Helper components often make distributed invocations to the business tier.
    • Helper invokes a business service without knowing details about its physical
    • implementation and distribution
    • May be implemented as a JavaBean
Consequences
  • Improves Application Partitioning, Reuse and Maintainability
  • Improves Role Separation

Related Patterns
  • Business Delegate
    • Delegate hides from the client the underlying details of looking up and accessing the
      business services
    •  Also provide intermediate caching to reduce network traffic
  • Dispatcher view and Service to Worker
    • Combines Front Controller and View Helper with a dispatcher
  • Front Controller