Modifying JSP files to display the Management Center objects.

JSP files are responsible for retrieving Management Center objects by transforming nouns into XML. The Management Center uses this XML to create objects. The new objects have already been defined, now you will change the JSP files to provide corresponding XML for your objects. Serialization JSP files need to be created, to add the section to compare the object storeId with the current storeId in order to dynamically set the object type.

About this task

Import all JSP files:


  1. In WebSphere Commerce Developer, click File > Import.
  2. In the Import window, click File System then click Next.
  3. Browse From directory to TutorialEsiteSourceCode\LOBTools\WebContent\jsp\mycompany\recipe. The Into folder is WCDE_installdir\workspace\LOBTools\WebContent\jsp\mycompany\recipe.
  4. Select all files in the folder.
  5. Click Finish. Click Yes to All to overwrite any existing files.
    Note: The following code samples illustrate how to support extended sites by changing JSP files.
    • Before the customization in this lesson, the code snippets in the original RecipeCollection serialization JSP file look like the following sample:
      <c:forEach var="projectColl" items="${projectCollections}">
      	<object objectType="RecipeCollection"> <collectionId>${projectColl.projectCollectionIdentifier.uniqueID}</collectionId>
      		<c:forEach var="description" items="${projectColl.description}">
      			<object objectType="RecipeCollectionDescription"><description><![CDATA[${description.value}]]></description>
      				<languageId>${description.language}</languageId> </object>
      		</c:forEach> </object>
    • As has been mentioned, the Management Center framework needs to know which store an object came from so that it can handle the objects correctly. JSP files provide this information by providing the correct objectType. In the RecipeCollection serialization JSP file, you need to compare the current storeId with the storeId of RecipeCollection. If the two storeIds are equal, the object type should be RecipeCollection. if the two storeIds are not equal, the object type should be InheritedRecipeCollection. The objectStoreId should be added to indicate which store that the object belongs to. The following code snippets in the RecipeCollection serialization JSP file provide extended sites support:
    • <objects
      <c:forEach var="projectColl" items="${projectCollections}">
      	<c:set var="objectType" value="RecipeCollection" />
      	<c:set var="collectionOwningStoreId"
      		value="${projectColl.projectCollectionIdentifier.externalIdentifier.storeIdentifier.uniqueID}" />
      	<c:if test="${param.storeId !=collectionOwningStoreId}">
      		<c:set var="objectType" value="InheritedRecipeCollection" />
      	<object objectType="${objectType}"> <objectStoreId>${collectionOwningStoreId}</objectStoreId>
      		<c:forEach var="description" items="${projectColl.description}">
      			<object objectType="RecipeCollectionDescription">
      				<languageId>${description.language}</languageId> </object>
      Before adding extended sites support After adding extended sites support
      Screen capture Screen capture displaying the Recipes tool before extended sites support is added. Screen capture displaying the Recipes tool after extended sites support is added.
      Comments You can only see local RecipeCollections. You can see both local RecipeCollections and asset RecipeCollections.