JSP programming best practice: Use the Commerce-specific tag for bean activation

WebSphere Commerce data beans require activation prior to their use. WebSphere Commerce provides a Commerce-specific version of the useBean tag, <wcbase:useBean>, that performs data bean activation in Java-free manner and is the recommended method of data bean activation in store JSP pages.

As an example, the generic way of activating a category data bean is as follows:

<jsp:useBean id="categoryBean"
class="com.ibm.commerce.catalog.beans.CategoryDataBean">
  <%
com.ibm.commerce.beans.DataBeanManager.activate(categoryBean,
request, response); %>         
</jsp:useBean>

The recommended way of accomplishing the same task in WebSphere Commerce store pages is as follows:

<wcbase:useBean id="categoryBean"
classname="com.ibm.commerce.catalog.beans.CategoryDataBean" />
Note: Data bean activation can fail and cause an exceptional condition. To comply with the JavaServer Pages Specification requirement that no output be written to the output stream when forwarding to other Web assets, including error pages, data beans should be activated at the beginning of the JSP page.