cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 5517] - How to generate XML tags within methods?!
Date Thu, 20 Dec 2001 00:18:25 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5517>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5517

How to generate XML tags within methods?!

phantom@stserv.hcf.jhu.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME



------- Additional Comments From phantom@stserv.hcf.jhu.edu  2001-12-19 16:18 -------
This uses esql, but the principal is the same.

<?xml version="1.0"?>
<xsp:page
language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:esql="http://apache.org/cocoon/SQL/v2">

<xsp:structure>
<xsp:include>java.util.Calendar</xsp:include>
<xsp:include>java.util.Date</xsp:include>
<xsp:include>java.text.SimpleDateFormat</xsp:include>
</xsp:structure>

<xsp:logic>
  private void print_msgs(int bid, int parent ) throws SAXException {
    AttributesImpl xspAttr = new AttributesImpl();
    String lastMonth = null;
    SimpleDateFormat sqlDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DATE, -30);
    lastMonth = sqlDate.format( cal.getTime() );

    <esql:connection>
      <esql:pool>phantom</esql:pool>
      <esql:execute-query>
        <esql:query>
          select message.id, parent_id, subject, first_name, last_name,
date_posted from message left join user on message.user_id=user.id where
parent_id=<xsp:expr>parent</xsp:expr> and hidden=0 and date_posted >
'<xsp:expr>lastMonth</xsp:expr>' order by date_posted desc
        </esql:query>
        <esql:error-results>
            <esql:get-stacktrace/>
        </esql:error-results>
        <esql:results>
          <ul class="messages">
            <esql:row-results>
              <li><a><xsp:attribute
name="href">viewmessage.xsp?id=<esql:get-string
column="id"/></xsp:attribute><esql:get-string column="subject"/></a>
<esql:get-string column="first_name"/> <esql:get-string column="last_name"/>
<em><esql:get-string column="date_posted"/></em>
              <xsp:logic>print_msgs(0,<esql:get-int column="id"/>);</xsp:logic></li>
            </esql:row-results>
          </ul>
        </esql:results>
      </esql:execute-query>
    </esql:connection>
  }
</xsp:logic>

<page>
  <title>Student Consultant Server</title>
        <div class="dontbreakme">
    <div class="messages" >
      <xsp:logic>print_msgs(1, 0);</xsp:logic>
    </div>
    </div>
</page>

</xsp:page>

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message