ATG Form Handler Best Practices Do's

  • Each and every JSP page should be associated with one form handler,it may be custom or OOTB form handler.
  • Avoid reusing custom formhandler; ideally it should be one to one mapping between page and custom formhandler.  This will reduce the maintenance effort and increase the readability.
  • Formhandler scope may be request or session, request scope is always recommended. Sometimes we can define session scope if the formhandler is called several times in one session, to avoid creation of multiple copies. But be very careful, you need to reset and initialize formhandler field after usage.
  • Formhandler should only refer to same scope or higher scope component i.e. session formhandler should never refer to any request scope component;session and global are valid scopes,and allowed.Never use Nucleus.resolveName to resolve component,this is very extremely expensive call. Better re-think about your component architecture.
  • Formhandler should never refer to another formhandler.  If they share form fields, better put those fields in base formhandler and then extend it. If this doesn’t solve well the purpose and makes your design complex, move common method to manager and refer it from formhandler to reuse code. ATG formhandlers are designed to be invoked from page. If you use it through component reference in other components, you may miss initialization beforeSet and afterSet callback methods.
  • All page data should be passed through formhandler, avoid passing any attribute through request and session.
  • Set the priority of the field to "-10" for required input fields other than submit button, so that it gets invoked after all of the setters have been called.
  • Return false from formhandler handler method if you are done with the page and no need to process the page further.
  • Return true to redirect to success page.
  • See ATG Repository Best Practices
  • See ATG Form Handler Basics 
  • See ATG Transaction Best Practice 
  • See ATG Weblogic Best Practices

Comments

Popular posts from this blog

BCC site status inaccessible Agent Production in error state

Weblogic Issues during EAR Deployment Exception in AppMerge flows progression

Add a shopping cart button to the product page