You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Da...@Equifax.com on 2008/01/10 14:52:35 UTC

Newbie needs help with display of values on page

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
postmaster@equifax.com.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Newbie needs help with display of values on page

Posted by Davor Hrg <hr...@gmail.com>.
5.0.8-SNAPSHOT has new var: binding prefix
but it is only for simple values, without expression evaluation.
for example to display loop index.


Davor Hrg


On Jan 10, 2008 2:52 PM,  <Da...@equifax.com> wrote:
>
> 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
> postmaster@equifax.com.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Newbie needs help with display of values on page

Posted by Mark Horn <ma...@agilesrc.com>.
Dave,

The Tapestry 5 Wiki help me a lot.  It can be found at:

http://wiki.apache.org/tapestry/#head-fa893a125e25b4c453eaab4fc08b8fb5d00ca04a

Also, There are some nice tutorials/examples available at:

http://code.google.com/p/shams/

-Mark

On 1/10/08, Dave.Derry@equifax.com <Da...@equifax.com> wrote:
>
> 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
> postmaster@equifax.com.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Newbie needs help with display of values on page

Posted by Shing Hing Man <ma...@yahoo.com>.
I think the new binding var (available from Tapestry
0.8 snapshot)  is what you are looking for.
Document is available at the following.

http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/parameters.html

There is also a post on this last week.

Shing

--- Dave.Derry@Equifax.com wrote:

> 
> 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
> postmaster@equifax.com.
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
> users-help@tapestry.apache.org
> 
> 


Home page : http://www.lombok.demon.co.uk/



      __________________________________________________________
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org