Customizing storefront pages
Customize storefront JavaServer Page files (JSP files) and the Spring MVC views that invoke them to modify how store pages are generated and returned to users of the store. Make additions or modifications to existing JSP files, or add new JSP files to extend the functionality of your storefront.
About this task
This process also provides the ability for you to customize IBM provided widgets and store pages. Once these files are moved into your custom store web archive, they are no longer updated automatically during the migration process. Therefore, these custom JSP files remain fully under your control. These JSP files can be relied on to function in the same way until any further customizations are made, or updates to their originals within the IBM provided store archive are merged manually.
The example procedure that is provided details the task flow that is required to customize existing and add new store pages to your storefront. Individual file, folder, and store names should reflect your own store environment and the customization that you are intending to implement.
Procedure
-
Create or extend the custom view
crs-web.war/WEB-INF/spring/MyStore/member-views-ext.xml
configuration file with the modified view definition. This example is the exact same view definition
as member-views.xml. The only difference is the JSP file that is used.
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="GlobalLoginSignInView/MyStore" class="com.ibm.commerce.store.mvc.view.spring.StoreInternalResourceView"> <property name="url" value="/MyWidgets/com.ibm.commerce.store.widgets.GlobalLogin/GlobalLoginSignInRegistration.jsp"/> <property name="https" value="1"/> <property name="credentialsAccepted" value="P"/> <property name="storeDir" value="no"/> <property name="generic" value="1"/> </bean> </beans>
For more information about view controller customization, see Spring MVC and store controller customization.
-
Add the custom view to the extended view controller definition file.
-
Create or extend your new JSP file or JSP files. If you are customizing existing JSP files from
the IBM provided store web archive, move them and all of their dependencies to the custom store web
archive.
In this example, these JSP files include:
- The custom extended JSP file, crs-web.war/WebContent/MyWidgets/com.ibm.commerce.store.widgets.GlobalLogin/GlobalLoginSignInRegistration.jsp. Originally located in the crs-web.war/WebContent/Widgets_701/com.ibm.commerce.store.widgets.GlobalLogin/ directory.
- The referenced JSP fragment files, now located in the
crs-web.war/WebContent/MyWidgets/
directory. Originally located in the
crs-web.war/WebContent/Widgets_701/
directory:
- /Common/EnvironmentSetup.jspf
- /Common/JSTLEnvironmentSetup.jspf
- /Common/ErrorMessageSetup.jspf
- /Common/nocache.jspf
- /com.ibm.commerce.store.widgets.GlobalLogin/GlobalLoginSignInRegistration_Data.jspf
Note: You can copy all referenced JSP files into the stores web archive. If you are referencing JSP files in other archives (such as default JSP files in the IBM provided store archive), then you can use the targetServletName property to reference them. For example,<property name="targetServletName" value="IBMStores"/>
means that the referenced JSP is in the IBM provided store archive. - Customize any JSP files that you created or extended within the custom store web archive.
- Restart the Store server.