Home

  

Product

  

Buy

  

Support

 First Line 
 FAQs 
 Tutorials 
 Registered Users 
 User Guide 
 Knowledge Base 

News

  

Press

  

Downloads

  

Contact

  

Company

  

Partners

  

Resources

 
 
Knowledge Base

ID: 3
Date: 10/05/2003
Title: Web Styles
Content: 

  1. Overview
  2. In JCodeBox, a web style governs how your generated web application will be configured and how it will operate at runtime. It dictates what components JCodeBox will automatically generate for you (system components i.e. an application error JSP) and how the different parts of your web application will interact (i.e. using a front controller servlet to forward requests).

    Currently there are two web style settings available (in JCodeBox system options):

    • None

    • No web style will be applied to your generated web application

    • View helper/Service to workers (VHSTW)

    • The View helper/Service to workers web style will be applied to your generated web application

  3. Web style: View helper/Service to workers (VHSTW)
    1. VHSTW: Overview
    2. The View helper/Service to workers web style applies the following J2EE design patterns to your generated web application:

      • Front controller

      • Provides a single, central entry point to your application.

      • View helper

      • Encapsulates business functionality and data for view components (JSP).

      • Service to workers

      • Combines the front controller and view helpers whereby the controller (with combined dispatcher) delegates processing to view helpers which then provide data for the views.

    3. VHSTW: View paths
    4. In JCodeBox, a view path represents a list of views (and their associated processing) required to complete an action i.e. to edit a customer record, JCodeBox creates a view path with two views; one to find the customer (i.e. findByPrimaryKey) and one to actually edit the customers details.

    5. VHSTW: View sets
    6. In JCodeBox, a view set represents a set of view paths for a particular entity/EJB. If you add a view set to your application in the JCodeBox GUI, at generation time JCodeBox will attempt to automatically create as many view paths for the selected entity/EJB as possible. Usually the following view paths are always created (for entities in web applications and for entity EJBs in enterprise applications):

      • Maintain entity
      • Create entity (can be affected by CMR settings)
      • Find entity (by primary key)
      • Delete entity
      • EJB information (for EJBs)

      In addition to this, JCodeBox will attempt to create additional view paths for the following:

      • Additional finders
      • Additional creators
      • Business methods
      • BMP relationships
      • Data transfer patterns (i.e. Value Object)
      • Home methods

      In general, view paths can only be created where primitive types are used i.e. a business method must only use primitive types for its parameters and for its return value.

      View sets can be a massive time saver as they allow you to test many aspects of your entities/EJBs by adding a single component to your JCodeBox application.

    7. VHSTW: System generated components
    8. DescriptionDefault nameDefault locationNotes
      System error pageSystemError.jsp/syspagesDisplays system errors
      Application error pageAppError.jsp/syspagesDisplays application errors
      System message pageSystemMessage.jsp/syspagesDisplays system messages
      System menu pageSystemMenu.jsp/syspagesDisplays system menu. Optional - can be disabled from web tier properties
      Front controller servletfront.java<<base package>>.servletsEntry point to web application
      View helper interfaceViewHelper.java<<base package>>.servlets.helpersImplemented by concrete view helpers. Contains one method definition: public void processRequest(HttpServletRequest req, HttpServletResponse resp, ServletContext sc) ;
      Request helper interfaceRequestHelper.java<<base package>>.servlets.helpersImplemented by concrete request helpers. Allows HTTP request variables to be retrieved in a protocol neutral way.
      View path classViewPath.java<<base package>>.servlets.helpersManages a view path for an action e.g. edit customer (i.e. given a view, will return the next view in the path)
      View helper map classViewHelperMap.java<<base package>>.servlets.helpersMaps view helper names to their variable and class names (i.e. the CUSTOMEREJB View Set may be stored in a variable called CUSTOMEREJBViewHelperVar with a type of com.mycompany.myapp.viewhelpers.CUSTOMEREJBViewHelper)

    9. VHSTW: request variables
    10. DescriptionVariable nameNotes
      The target view set for this request (if applicable)ViewSetIf applicable, contains the target view set name. The front controller servlet uses this name to lookup the view helper that will process this request. Can contain JSPDIRECT or SRVDIRECT if front is to forward directly to a JSP or a servlet.
      The target view path for this requestPathUsed by the view helper along with the source view to determine the next view to be displayed (the view helper queries the view path map object).
      The source view this request originated fromSourceViewUsed by the view helper along with the path to determine the next view to be displayed (the view helper queries the view path map object).
      The target action for this requestActionUsed by the view helper to determine what action (processing) is being requested (e.g. maintainCUSTOMEREJB) or by the front controller to determine the name of the resource (JSP or servlet) to forward to (e.g. /somePage.jsp)

    11. VHSTW request processing
    12. The following diagram displays graphically how the View helper/Service to workers web style processes HTTP requests.

      Steps:

      1. A HTTP request is received
      2. The front controller extracts the request query variables including the view set name
      3. If the request (view set name) is for a direct resource, forward to the resource (JSP or servlet) otherwise ...
      4. Lookup/create the view helper associated with this view set name (stored in session object)
      5. Ask the view helper to process the request
      6. The view helper processes the request (i.e. connects to a remote database/EJB, etc) and stores data locally
      7. The view helper then gets the next view in the path from the view path map
      8. The view helper then forwards the request to the next view
      9. The view sends the HTTP response back to the client/browser (retrieving any data required to render the view from the view helper)

[an error occurred while processing this directive]