ATG Best Practices Form Handler Dont's

Don’t mix business logic with presentation: Formhandler and JSP page should not have any business logic. It should only contain page field’s validation. All business logic regarding validation should be defined in global component and formhandler should refer to it in handler method.

Reusable components: Different Formhandlers will be able to reuse the components.

Separation of business logic and presentation logic: You can change the way data is displayed without affecting business logic. In other words, web page designers can focus on presentation and Java developers can focus on business logic.

Don’t use FormHandler to load the page information, use Droplet to populate data for  display

o They can eliminate scriptlets in your JSP applications. Any 
  necessary parameters to the Droplet can be passed as attributes, 
  and therefore no Java code is needed to initialize or set
  component properties.

o They have simpler syntax. Scriptlets are written in Java code, but
  OOTB or custom Droplet can be used in an HTML-like syntax.

o They can improve the productivity of frontend or content

o They are reusable. They save development and testing time.
  Scriptlets are not reusable, unless you call cut-and-paste

Never call Nucleus component and web services from Page. This may be fast and easy to use but at the cost of many other important features of formhandler like field security, cross
scripting attack, encoding and decoding.

Never set successUrl, errorUrl and other url for redirect from JSP page. This  should   be set   into   formhandler properties files. Defining redirect urls on page increase the  risk of  cross -site scripting attacks.

Try not to re-invent the wheel: ATG provides wide range of ATG OOTB droplets and Formhandlers.

Check to see if what you want is already available. Avoid writing Formhandler from scratch, find the component closest in functionality to what the application needs and extend it if needed.

See Also   


Post a Comment

Related Posts Plugin for WordPress, Blogger...