Tutorials > Management Center > Support extended sites in the Recipes tool
Modify 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 we 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.
Procedure
Import all JSP files:
- In WebSphere Commerce Developer, click File > Import.
- In the Import window, click File System then click Next.
- Browse From directory to TutorialEsiteSourceCode\LOBTools\WebContent\jsp\mycompany\recipe. The Into folder is WCDE_INSTALL\workspace\LOBTools\WebContent\jsp\mycompany\recipe.
- Select all files in the folder.
- Click Finish. Click Yes to All to overwrite any existing files.
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:
<objects> <c:forEach var="projectColl" items="${projectCollections}"> <object objectType="RecipeCollection"> <collectionId>${projectColl.projectCollectionIdentifier.uniqueID}</collectionId> <collectionName><![CDATA[${projectColl.projectCollectionIdentifier.externalIdentifier.name}]]></collectionName> <c:forEach var="description" items="${projectColl.description}"> <object objectType="RecipeCollectionDescription"><description><![CDATA[${description.value}]]></description> <languageId>${description.language}</languageId> </object> </c:forEach> </object> </c:forEach> </objects>
- 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, 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 recordSetCompleteIndicator="${showVerb.recordSetCompleteIndicator}" recordSetReferenceId="${showVerb.recordSetReferenceId}" recordSetStartNumber="${showVerb.recordSetStartNumber}" recordSetCount="${showVerb.recordSetCount}" recordSetTotal="${showVerb.recordSetTotal}"> <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" /> </c:if> <object objectType="${objectType}"> <objectStoreId>${collectionOwningStoreId}</objectStoreId> <collectionId>${projectColl.projectCollectionIdentifier.uniqueID}</collectionId> <collectionName><![CDATA[${projectColl.projectCollectionIdentifier.externalIdentifier.name}]]></collectionName> <c:forEach var="description" items="${projectColl.description}"> <object objectType="RecipeCollectionDescription"> <description><![CDATA[${description.value}]]></description> <languageId>${description.language}</languageId> </object> </c:forEach> </object> </c:forEach> </objects>
Before adding extended sites support After adding extended sites support Screen capture
Comments You can only see local RecipeCollections. You can see both local RecipeCollections and asset RecipeCollections.