<sql:setDataSource driver="${initParam.dataSourceDriver}" url="${initParam.dataSourceUrl}" user="${initParam.dataSourceUser}" password="${initParam.dataSourcePassword}"/>

<c:set var="hostname"><%=getURI(serviceBean.serviceItem.attributeSets).getHost()%></c:set>
<table border=1>
<tr><td>Time</td><td>UNI</td><td>Amount</td></tr>
<c:choose>
<c:when test="${param.uni==null || param.uni==''}">
  <tr><td colspan=3>Last 25 Jobs</td></tr>
  <sql:query var="rs" maxRows="25">
    SELECT uni,amount,to_char(print_date,'MM/DD hh24:mi:ss') time
    FROM printlog
    WHERE printer=?
    ORDER BY print_log_id desc
    <sql:param value="${hostname}"/>
  </sql:query>
</c:when>
<c:otherwise>
  <tr><td colspan=3>Last 10 days by <c:out value="${param.uni}"/></td></tr>
  <sql:query var="rs">
    SELECT uni,amount,to_char(print_date,'MM/DD hh24:mi') time
    FROM printlog
    WHERE print_date>sysdate-10 AND printer=? AND uni=?
    ORDER BY print_log_id desc
    <sql:param value="${hostname}"/>
    <sql:param value="${param.uni}"/>
  </sql:query>
</c:otherwise>
</c:choose>
<FORM ACTION="<c:out value='${alias}'/>/selector.jsp?view=monitor" METHOD=POST>
<tr><td></td><td><input type=text size=10 name="uni"/></td><td><input type=submit value="refresh"/></td></tr>
</form>
<c:forEach items="${rs.rows}" var="row">
    <tr>
    <td><c:out value="${row.time}"/></td>
    <td><c:out value="${row.uni}"/></td>
    <td><c:out value="${row.amount}"/></td>
    </tr>
</c:forEach>
</table>
