Forum OpenACS Development: Re: OT: JSP equivalent of OpenACS template tags

Collapse
Posted by Dave McBride on
I am not sure if I have used what you described, but I wrote a manufacturing app using JSPs hooked to postgresql running with the Tomcat web server.

My JSP's looked very similar to OpenACS .tcl files, like the old 3.x type that did not have .adp pages associated with them (see old version of ecommerce package).

It connected to the db, did a query, which got back a result set, then I did a while loop. See example:

  Statement stmt2 = con.createStatement();
  String queryStr2 = "SELECT part_id, part_name, sku, barcode, count, minimum FROM manu_parts where active='t' AND wip='f' AND count < minimum order by sku";
  ResultSet rs_parts = stmt2.executeQuery(queryStr2);

<%  while(rs_parts.next()) {
      count++; %>
      <tr>
        <td><%= count %>.</td>
        <td>Part</font></td>
        <td><%= rs_parts.getString("part_name") %></td>
      </tr>

<%    } // end while() %>

Here is an 'if' statement for JSP's as well.

<%    if (rs_products.getInt("count") >= rs_products.getInt("minimum")) { %>
        <td align=center><font size=-1 ><%= rs_products.getString("count")%></font></td>
<%    } else { %>
        <td align=center bgcolor="red"><font size=-1 color=white><%= rs_products.getString("count")%></font></td>
<%    } %>

I will send you versions of some of my files to show you how I did it if you would like to see them. I found this worked like the multiple in OpenACS. I can create JSP pages much like the OpenACS pages I write.

Dave McBride