Starter store conventions
WebSphere Commerce starter stores follow naming conventions for the following items:
JSP files
Follow these conventions when naming JSP files:
- Use camel case style for all JSP files, for example CamelCase.jsp.
- Begin JSP file names with a noun (CatalogSearchForm.jsp) or adjective (AdvancedCatalogSearchForm.jsp).
- Do not repeat the section name in the JSP file name. For example, AddressBookDisplay.jsp belongs to the Account section, but the JSP file does not need to include Account as part of the name.
- Do not use short forms in the JSP file name, unless using the full name would exceed the maximum directory length limit.
There are two types of JSP pages:
- Display JSP pages
- Display JSP pages present the visual exterior of a store page and contain JSTL display logic, HTML, and JSP custom tags. They should not contain business logic or Java code. Note that some display JSP pages in the starter stores do presently contain Java code.
- Non-display or setup JSP pages
- These are any JSP pages that do not display information. A setup JSP page might prepare data. For example, EnvironmentSetup.jsp retrieves and prepares the JSP path, file path, and resource bundle. Other JSP pages use this information. A setup JSP page may also be used for conditional routing. An example of a JSP page used for routing is AllocationCheckSetup.jsp. This JSP page includes different JSP pages that are based on different conditions in the database. It shows the ProductAvailability page if only some items are available, and it shows the OrderSummary page if all items are available or if all items are unavailable.
The suffix, or sometimes the prefix, of a JSP file name indicates the type of the JSP page according to the following conventions:
JSP file suffixes
- Setup
- A setup JSP page; for example, JSTLEnvironmentSetup.jspf.
- Form or Display
- A display JSP page; for example, CachedSideBarDisplay.jsp. A display JSP file might contain an input form.
- Notify
- An e-mail JSP page; for example, PasswordResetNotify.jsp.
JSP file prefixes
- Cached
- A JSP page designed to be cached. Sometimes a JSP page is divided so that it can be cached. Examples of cached JSP files are CachedSidebarDisplay.jsp and CachedHeaderDisplay.jsp.
Naming conventions for variables within JSP files
Use these conventions for variable names:
- Use descriptive names
- Start with a lowercase letter.
- Use camel case. In the following example the variable, storeId, has the same name as the URL parameter.
<c:set var="storeId" value="${WCParam.storeId}"/>
JSP templates
The starter stores use a JSP template mechanism. JSP templates maintain a set of common files, which allows the application developer to reflect changes easily. It also provides a common look and feel for all store pages. These files implement a common set of functions. Most starter store pages link to these JSP template files:
- index.jsp
- This file provides an entry point to the store. It forwards the page to appropriate URL for the storefront. Each of the commands that are used as a storefront command has some required parameters, namely, storeId, languageId, and catalogId. The value of the storeId variable and the catalogId variable are known after the store has been published. The index.jsp file is not the include file; the include file is parameters.jsp. The parameters.jsp include file contains the value for the storeId variable and the value for the catalogId variable. Publishing the store updates the parameters.jsp file.
- CachedHeaderDisplay.jsp
- This file contains common links displayed at the top of store pages.
- CachedFooterDisplay.jsp
- This file contains common links displayed at the bottom of store pages.
- CachedSidebarDisplay.jsp
- This file contains the mini shopping cart, choice of language and currency, search, e-Marketing Spot, and quick order functionalities.
- JSTLEnvironmentSetup.jspf
- This JSP file includes access to the resource bundle, which contains the locale-specific text for all the store pages. In this way, you can maintain a multilingual store from one set of JSP files. The EnvironmentSetup.jsp file contains all commonly needed attributes, such as StoreDir, includeDir, fileDir, and bundleDir. Almost all JSP files in the store call this JSP file.
Properties files
The name of the properties file should be StoreName_locale.properties. Stores that support multiple languages should have a default properties file called StoreName.properties to be searched for strings not found in StoreName_locale.properties, which WebSphere Commerce searches first.Use these conventions for properties files:
- Begin each section with a comment that identifies the section.
- Place all text strings in a properties file.
- Prepend all strings on the page with the same identifier. The identifier uniquely identifies the page.
- Assemble text messages dynamically. Use placeholders in the properties file for the substitutions.
- Name strings descriptively. For example, use logon_userid, logon_password instead of logon_column1 or logon_field1.
Location structure and directory structure
Environment File path JSP files (i5/OS)
(Linux)(Windows)WC_eardir/Stores.war/storedir/ workspace_dir\Stores\Web Content\storedir\ Properties files (i5/OS)
(Linux)(Windows)WC_eardir/Stores.war/WEB-INF/classes/storedir/ workspace_dir\Stores\Web Content\WEB-INF\classes\storedir\ Change Flow files (i5/OS)
(Linux)(Windows)WC_eardir/Stores.war/WEB-INF/xml/tools/stores/storedir/ workspace_dir\Stores\Web Content\WEB-INF\xml\tools\stores\storedir\ Change Style thumbnail images (i5/OS)
(Linux)(Windows)WC_eardir/Stores.war/tools/stores/storedir/style/ workspace_dir\Stores\Web Content\tools\stores\storedir\style\ Change Pages preview pages (i5/OS)
(Linux)(Windows)WC_eardir/Stores.war/tools/stores/storedir/text/ workspace_dir\Stores\Web Content\tools\stores\storedir\text\ Related concepts