Develop > Controller layer > Management Center Web application > Map between the Management Center client and WebSphere Commerce nouns > Retrive Management Center objects by transforming Nouns into XML


Serialization JSP fragment example

The serialization JSP fragments format Nouns from the controller JSP into XML format.


SerializeCatalogEntry.jspf

<%
    // Given the catalogEntry object, convert this object into the corresponding
    // Management Center object representation.
%>
<object objectType="${objectType}" objectId="${catalogEntry.catalogEntryIdentifier.uniqueID}">     <type><![CDATA[${objectType}]]></type>     <catenttypeId readonly="true"><![CDATA[${catalogEntry.catalogEntryTypeCode}]]></catenttypeId>     <catentryId><![CDATA[${catalogEntry.catalogEntryIdentifier.uniqueID}]]></catentryId>     <ownerId><![CDATA[${catalogEntry.catalogEntryIdentifier.externalIdentifier.ownerID}]]></ownerId>
<%
    // Mark the object property as read only if it is an ItemBean.
%>    
    <c:when test="${catalogEntry.catalogEntryTypeCode == 'ItemBean'}">                 <partnumber readonly="true">     </c:when>     <c:otherwise>         <partnumber>     </c:otherwise>    
        <![CDATA[${catalogEntry.catalogEntryIdentifier.externalIdentifier.partNumber}]]></partnumber>     <onAuction><![CDATA[false]]></onAuction>     <catalogId><![CDATA[${param.catalogId}]]></catalogId>
<%
    // Special handling for the UserData element of the CatalogEntry noun to
    //  pass additional information returned by the service without any
    // additional modification.
 %>     <c:forEach var="userDataField" items="${catalogEntry.userData.userDataField}">         <x_${userDataField.typedKey}><![CDATA[${userDataField.typedValue}]]></x_${userDataField.typedKey}>     </c:forEach>
<%
    // Include other JSP fragments to convert other elements of the catalog entry
    // into child objects of the Management Center object.
%>     <jsp:directive.include file="SerializeCatalogEntryDescription.jspf"/>     <jsp:directive.include file="SerializeCatalogEntryListPrice.jspf"/>     <jsp:directive.include file="SerializeCatalogEntryExtraProperties.jspf"/>     <c:if test="${objectType == 'ProductSKU'}">         <jsp:directive.include file="SerializeCatalogEntrySKUDefiningAttribute.jspf"/>     </c:if>
</object>

Related reference

GetCatalogEntry.jsp example

XML output sample


+

Search Tips   |   Advanced Search