OrderMonthView.jsp

 

+

Search Tips   |   Advanced Search

 

 

<%@page session="false" 
        contentType="text/html" 
        pageEncoding="ISO-8859-1" 
        import="java.util.*,javax.portlet.*,com.ibm.etools.portlet.jsr286.*" %>

<%@ taglib uri="http://java.sun.com/portlet_2_0" 
           prefix="portlet"%>        

<%@taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model" 
          prefix="portlet-client-model" %>        

<portlet:defineObjects/>
<portlet-client-model:init>
      <portlet-client-model:require module="ibm.portal.xml.*"/>
      <portlet-client-model:require module="ibm.portal.portlet.*"/>   
</portlet-client-model:init>         



<%-- Cast OrderMonthBean --%>
<%
    OrderMonthBean omb = (OrderMonthBean) renderRequest.getAttribute(OrdersPortlet.ORDER_MONTH_BEAN);
    String actionUrlStr = omb.getActionURL().toString();
%>
   <p>
    <b>Orders for <%= omb.getMonth() %></b>
    </p>

    <table border="0" cellspacing="0" cellpadding="3">
      <tr class="wpsTableHead">
        <td>
        Order_ID
        </td>

        <td>
        Customer_ID
        </td>

        <td>
        Status
        </td>

      </tr>

      <%
        Order[] orders = omb.getOrders();
        boolean areOrderIdWiresActive = true;
        boolean areCustomerIdWiresActive = true;

        

        for (int i = 0; i < orders.length; i++) { %>

      <tr class="<%=((i % 2) == 0)?"wpsTableShdRow":"wpsTableRow"%>">

        <td>
         <%  
                if ( areOrderIdWiresActive ) {
                    PortletURL actionURL = renderResponse.createActionURL();
                    actionURL.setParameter(OrdersPortlet.ORDER_ID, orders[i].getOrderId());
                    actionURL.setParameter(OrdersPortlet.ACTION_NAME_PARAM, OrdersPortlet.ORDERS_FOR_MONTH);
         %>       
                    <A href="<%= actionURL%>">
                     <%= orders[i].getOrderId() %>
                    </A>
             <% } else { %>          
                <%= orders[i].getOrderId() %>
             <% } %>

        </td>

        <td>

        <%-- If the output property "customerId" is wired with active actions, then set a link to trigger action--%>

        <%  
            if ( areCustomerIdWiresActive ) {  
                    PortletURL actionURL = renderResponse.createActionURL();
                    actionURL.setParameter(OrdersPortlet.CUSTOMER_ID, orders[i].getCustomerId());
                    actionURL.setParameter(OrdersPortlet.ACTION_NAME_PARAM, OrdersPortlet.ORDERS_FOR_MONTH);
         %>       
                    <A href="<%= actionURL %>">
                     <%= orders[i].getCustomerId() %>
                    </A>
         <% } else { %>          
                <%= orders[i].getCustomerId() %>
         <% } %>
        </td>


        <td>
        <%-- If the output property "orderId" and "customerId" are wired with active actions, then set a link to trigger action--%>

        <%  
                if (( areOrderIdWiresActive ) & ( areCustomerIdWiresActive )) {
                    PortletURL actionURL = renderResponse.createActionURL();
                    actionURL.setParameter(OrdersPortlet.ORDER_ID, orders[i].getOrderId());
                    actionURL.setParameter(OrdersPortlet.CUSTOMER_ID, orders[i].getCustomerId());
                    actionURL.setParameter(OrdersPortlet.ACTION_NAME_PARAM, OrdersPortlet.ORDERS_FOR_MONTH);
         %>       
                    <A href="<%= actionURL%>">
                     <%= orders[i].getStatus() %>
                    </A>
             <% } else { %>          
                <%= orders[i].getStatus() %>
             <% } %>


        </td>
      
      </tr>

      <% } %>

    </table>
    
      
  
    
  <div class="wpsPortletText">
    <FORM method="POST" action="<%= actionUrlStr %>" enctype="application/x-www-form-urlencoded" name="OrdersForMonthForm" >
      <LABEL class="wpsLabelText" for="<%= OrdersPortlet.MONTH %>">Enter month:</LABEL><BR/> 
      <INPUT class="wpsEditField" name="<%= OrdersPortlet.MONTH %>" type="text"/><BR/>
      <INPUT class="wpsButtonText" name="submit" type="submit" value="Submit"/>
    </FORM>
  </div>