A sample JSP file in the JSP console

The JSP files provided by Sterling Selling and Fulfillment Foundation cover every typical use case scenario that you encounter, so they are useful templates for developing your own JSP files. As you examine the JSP files, note that they are modular, which enables you to quickly customize a view by assembling nits of code together. In addition to the JSP file template, see the User Interface Style Reference topic for more technical details.

The following example shows some code from a typical order JSP file, which can be used to render an Order list view.

<%@taglib  prefix="yfc" uri="/WEB-INF/yfc.tld" %> 
<%@include file="/yfsjspcommon/yfsutil.jspf"%> 
<%@include file="/console/jsp/currencyutils.jspf" %> 
<%@ page import="com.yantra.yfs.ui.backend.*" %> 
<%@ include file="/console/jsp/modificationutils.jspf" %>
<script language="javascript" src="/smcfs
/console/scripts/modificationreason.js"></script> 
<table class="table" editable="false" width="100%" cellspacing="0">
   <thead>
      <tr>
         <td sortable="no" class="checkboxheader">
            <input type="hidden" name="userHasOverridePermissions" 
value='<%=userHasOverridePermissions()%>'/>
            <input type="hidden" name="xml:/Order/@Override" value="N"/>
            <input type="checkbox" name="checkbox" value="checkbox" 
onclick="doCheckAll(this);"/>
         </td>
         <td class="tablecolumnheader"><yfc:i18n>Order_#</yfc:i18n></td>
         <td class="tablecolumnheader"><yfc:i18n>Status</yfc:i18n></td>
         <td class="tablecolumnheader"><yfc:i18n>Enterprise</yfc:i18n></td>
         <td class="tablecolumnheader"><yfc:i18n>Buyer</yfc:i18n></td>
         <td class="tablecolumnheader"><yfc:i18n>Order_Date</yfc:i18n></td>
         <td class="tablecolumnheader"><yfc:i18n>Total_Amount</yfc:i18n></td>
      </tr>
   </thead>
   <tbody>
       <yfc:loopXML binding="xml:/OrderList/@Order" id="Order">
          <tr>
             <yfc:makeXMLInput name="orderKey">
                 <yfc:makeXMLKey binding="xml:/Order/@OrderHeaderKey"
value="xml:/Order/@OrderHeaderKey" />
             </yfc:makeXMLInput>
             <td class="checkboxcolumn">
                <input type="checkbox" value='<%=getParameter("orderKey")%>' 
name="EntityKey"/>
             </td>
             <td class="tablecolumn">
					           <a href="javascript:showDetailFor('<%=getParameter("orderKey")%>');">
						          <yfc:getXMLValue binding="xml:/Order/@OrderNo"/>
					           </a>
              </td>
              <td class="tablecolumn">
                  <% if (isVoid(getValue("Order", "xml:/Order/@Status"))) { %>
                     [<yfc:i18n>Draft</yfc:i18n>]
                  <% } else { %>
                     <yfc:getXMLValue binding="xml:/Order/@Status"/>
                  <% } %>
                  <% if (equals("Y", getValue("Order", "xml:/Order/@HoldFlag"))) 
                     { %>
                        <img class="icon" onmouseover="this.style.cursor='default'" 
<%=getImageOptions(YFSUIBackendConsts.HELD_ORDER, "This_order_is_held")%>/>
                  <% } %>
              </td>
              <td class="tablecolumn">
                  <yfc:getXMLValue binding="xml:/Order/@EnterpriseCode"/></td>
              <td class="tablecolumn">
                  <yfc:getXMLValue binding="xml:/Order/@BuyerOrganizationCode"/></td>
              <td class="tablecolumn" sortValue="<%=getDateValue
("xml:/Order/@OrderDate")%>"><yfc:getXMLValue binding="xml:/Order/@OrderDate"/></td>
              <td class="numerictablecolumn"
sortValue="<%=getNumericValue("xml:/Order/PriceInfo/@TotalAmount")%>">
                   <%=displayAmount(getValue("Order", 
"xml:/Order/PriceInfo/@TotalAmount"), (YFCElement) 
request.getAttribute("CurrencyList"), getValue("Order", 
"xml:/Order/@RulesetKey"), getValue("Order", 
"xml:/Order/PriceInfo/@Currency"))%>
               </td>
          </tr>
       </yfc:loopXML>
   </tbody> 
</table>

This example shows include files at the top. In order to access most of the common public JSP functions in the Presentation Framework, most JSP files only require a reference to the INSTALL_DIR/repository/eardata/platform/war/yfsjspcommon/yfsutil.jspf file, as in the following example of an include statement:

<%@include file="/yfsjspcommon/yfsutil.jspf"%>

To access the yfsGet*Options() JSP functions, you must reference the INSTALL_DIR/repository/eardata/platform/war/console/jsp/modificationutils.jspf file, as in the following example:

<%@ include file="/console/jsp/modificationutils.jspf" %>

For JavaScript functions, all public functions are automatically available to your JSP file.

Note: When you customize a javascript on the application console screen where prototype.js/rico.js is also used, you cannot load other javascript frameworks such as jQuery.