Things are kind of slow here at the office, so I'm taking advantage of that
to finally get a look at Tapestry. Though I'm a newbie to Tapestry, I'm not
a newbie to web development; I've worked with JSP, JSF, Struts, and even
XMLC. Thought I might as well dive into Tap5 since that's the future, even
though that seems to mean that the book I have (Kent Tong's) is of no value
to me (this is not a complaint; I know others have complained about the
lack of backward compatibility, but I realize that sometimes you just have
to drop that baggage in order to make any real progress forward). But I'm
having a tough time finding any documentation on page templates; how to
build them or display values.

I've started with the tutorial app, using v5.0.7,  and am gradually
extending it. I've gotten the Spring integration working, which was very
simple once I began to understand what I had done wrong. So I'm able to
leverage my existing knowledge, and get data from a database. I do intend
to look at the Tapestry IOC way of doing things, but I'm starting with
little steps; that will come later.

So what I've got at this point is a Jobs.tml that I can access from the
Start.tml. Jobs.java gets a ServiceDao injected by Spring, and uses that to
retrieve a list of JobStatus for display. A JobStatus consists of a String
jobId, a String projectNumber, and a Map<String,Status> stages. A Status is
an enum, and the stages Map maps various job stages to the status of that
stage. I access the Status of a job stage by calling getStatus(String
stage) on the JobStatus object.

In Jobs.tml I have:

  <table>
      <thead>
            <tr>
                  <th>Job ID</th>
                  <th>Project Number</th>
                  <th>Output Status</th>
                  <th>Shipment Info Posting</th>
                  <th>Bureau Code Posting</th>
                  <th>Inquiry Posting</th>
            </tr>
      </thead>
      <tbody>
          <tr t:type="loop" source="jobs" value="jobStatus" >
            <td>${jobStatus.jobId}</td>
            <td>${jobStatus.projectNumber}</td>
            <td>${outputStatus}</td>
            ....
          </tr>
    </tbody>
  </table>

There are a couple of things about this that bother me. It seems that
Jobs.java is required to have a jobStatus property (with getter/setter) to
support the iteration (and for no other reason). I can get the output
status with ${outputStatus} by adding a getOutputStatus() method to
Jobs.java, which then invokes the getStatus("Output") method on the
required JobStatus property. But to me that "smells" (to use XP
terminology). It seems that a temp variable could be created to support the
iteration (ala JSF), and I would rather access the output status by
something like ${jobStatus.getStatus("Output")}, without requiring an
artificial method in Jobs.java, especially since it appears that I'll have
to add a number of other, similar, artificial methods for the other
statuses.

I realize that I may have a *lot* wrong above, and my hope is that someone
will (gently) point those errors out to me. Better yet would be to (again
gently) point me to documentation that will explain the above.

Thanks,
Dave

We must begin not just to act, but to think, for there is no better slave
than the one who believes his slavery to be freedom, and we are in
no greater peril than when we cannot see the chains on our minds
because there are yet no chains on our feet.
-- Michael Reid


This message contains information from Equifax Inc. which may be
confidential and privileged.  If you are not an intended recipient, please
refrain from any disclosure, copying, distribution or use of this
information and note that such actions are prohibited.  If you have
received this transmission in error, please notify by e-mail
[EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to