Tutorials > Program model > Add a finder to an existing entity bean
Modify a JSP file to use the new finder
In this step we will modify the OrderStatusTableDisplay.jsp JSP file to call the getOrdersByTimePlaced method in the ExtendedOrderListDataBean. You will modify the JSP file to change the sorting order of the list of orders that were already processed.
Procedure
- In the Enterprise Explorer view, navigate to Stores > WebContent Consumer_Direct_name > Snippets > Order > Cart, where Consumer_Direct_name is the name of the consumer direct sample store.
- Create a backup copy of OrderStatusTableDisplay.jsp:
- Right-click OrderStatusTableDisplay.jsp and select Copy, then select Paste.
- In the Name Conflict window, enter OrderStatusTableDisplay.jsp.bak .
- Click OK.
- Double-click the OrderStatusTableDisplay.jsp file to open the file for editing.
- Locate the following code:
<wcbase:useBean classname="com.ibm.commerce.order.beans.OrderListDataBean"> <c:set target="${orderListBean2}" property="currentPage" value="${pageToDisplay}"/> <c:set target="${orderListBean2}" property="pageSize" value="${pageSize}"/> <c:set target="${orderListBean2}" property="sortMethodId" value="7"/> <c:set target="${orderListBean2}" property="storeId" value="${CommandContext.storeId}"/> <c:set target="${orderListBean2}" property="retrievalOrderStatus" value="N,M,A,B,C,R,S,D,F,G"/> <c:set target="${orderListBean2}" property="userId" value="${CommandContext.userId}"/> </wcbase:useBean> <c:set var="orderBeanList2" value="${orderListBean2.orderDataBeansForCurrentPage}" />
- Delete the code in the preceding step and replace it with the following code:
<wcbase:useBean classname="com.ibm.commerce.sample.databeans.ExtendedOrderListDataBean"> <c:set target="${orderListBean2}" property="currentPage" value="${pageToDisplay}"/> <c:set target="${orderListBean2}" property="pageSize" value="${pageSize}"/> <c:set target="${orderListBean2}" property="storeId" value="${CommandContext.storeId}"/> <c:set target="${orderListBean2}" property="retrievalOrderStatus" value="N,M,A,B,C,R,S,D,F,G"/> <c:set target="${orderListBean2}" property="userId" value="${userId}"/> </wcbase:useBean> <c:set var="orderBeanList2" value="${orderListBean2.ordersByTimePlaced}" />
- Save the changes.
- Restart the WebSphere Commerce Test Server to pick up the changes.