You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Simon Raveh <si...@icann.org> on 2009/03/01 06:09:05 UTC

Component rendering and parameters binding

Hi,

I'm switching from Tapestry 4 to to Tapestry 5 and I need help with a simple component.
I have a component ViewTicket that display Ticket information. The tml file code:

<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
    <div style="display: block;" id="output">
        <div id="assessment_panel">
            <div class="safe" id="box_assessment">
                <h2>Ticket Information</h2>
            </div>
        </div>
        <div id="results_panel">
            <table id="ns_table">
                <tbody>
                    <tr>
                        <th>Ticket ID</th>
                        <th>Status</th>
                        <th>Queue</th>
                        <th>Created</th>
                    </tr>
                    <tr>
                        <td>${ticketNumber}</td>
                        <td>${status}</td>
                        <td>${queue}</td>
                        <td>${created}</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</t:container>

And the java code

public class ViewTicket implements TicketViewer {

    @Inject
    private Logger logger;

    @Parameter(required = true)
    private RTTicket ticket;

    @Log
    @BeforeRenderTemplate
    void beforeRenderTamplate(){
    }

    @Log
    public Long getTicketNumber() {
        return ticket == null ? null : ticket.getId();
    }

    @Log
    public String getQueue() {
        return ticket == null ? null :ticket.getQueue();
    }

    @Log
    public String getStatus() {
        return ticket == null ? null :ticket.getStatus();
    }

    @Log
    public Date getCreated() {
        return ticket == null ? null : ticket.getCreated();
    }

    public void addTicket(RTTicket ticket) {
       this.ticket = ticket;
    }

    public void clearTicket() {
        this.ticket = new RTTicketImpl();
    }
}
And my page Index.tml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html t:type="layout" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
    <body>
        <h1>Request (Ticket) Information</h1>
        <p>To check the status of your request, please enter the ticket number (numerical value only) below: </p>
        <form t:type="form" t:id="search_form"  action="#">
            <t:errors/>
                Ticket ID:
                <input t:type="TextField" t:id="ticketId" t:clientId="id_query" validate="required"/>
                <input type="submit" value="Submit Query" id="form-submit-button"/>
         </form>
        <span t:type="ViewTicket" t:ticket="prop:ticket" />
    </body>
</html>

Index.java

public class Index {

    @Inject
    private Logger logger;

    @Property
    private long ticketId;

    void onValidateForm() {

    }

    void onSuccess() {
    }

    @Log
    public RTTicket getTicket() {
        return new RTTicketImpl();
    }
}

My problem is that Tapestry is calling the method getTicketNumber before the Ticket parameter is bound.
Here are the logging output:

[DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
[DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
[DEBUG] components.ViewTicket [ENTER] getTicketNumber()
[DEBUG] pages.Index [ENTER] getTicket()
[DEBUG] pages.Index [ EXIT] getTicket [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@3805fd37]
[DEBUG] components.ViewTicket [ EXIT] getTicketNumber [null]
[DEBUG] components.ViewTicket [ENTER] getStatus()
[DEBUG] components.ViewTicket [ EXIT] getStatus [null]
[DEBUG] components.ViewTicket [ENTER] getQueue()
[DEBUG] components.ViewTicket [ EXIT] getQueue [null]
[DEBUG] components.ViewTicket [ENTER] getCreated()
[DEBUG] components.ViewTicket [ EXIT] getCreated [null]

Any clue to what I'm doing wrong or help will be much appreciate

My second question is what the best way to cause the component ViewTicket not to render base on the state of the ticket it gets as parameter

Thanks,
Simon

Re: templates changes from tapestry 4.1 to tapestry 5

Posted by Ivano Luberti <lu...@archicoop.it>.
I understand and of course is always a problem of perspective.
In my practical work I always have to spend too much time in adjusting
html content when the web graphic modifies it, because obviously he/she
doesn't want to work with the mess that a jsp or a velocity template 
has become once I have worked on it.


Howard Lewis Ship ha scritto:
> A well established Tapestry style in Tap3 + Tap4 was:
>
> <if jwcid="@Conditional" condition="whatever"> ... </if>
>
> I really liked that style, especially for teaching Tapestry and wanted
> to allow something that immediately understandable but even more
> concise.
>
> On Wed, Mar 4, 2009 at 10:33 AM, Thiago H. de Paula Figueiredo
> <th...@gmail.com> wrote:
>   
>> Em Wed, 04 Mar 2009 13:18:46 -0300, Ivano Luberti <lu...@archicoop.it>
>> escreveu:
>>
>>     
>>> pheeew !
>>> Thanks for the quick answer to all of you.
>>>       
>> You're welcome!
>>
>>     
>>> I was afraid I had made one of the biggest mistake in my life.
>>>       
>> Maybe you just made one of the best decisions in your life.. :)
>>
>>     
>>> But can you tell me why the choice to abandon the old syntax has been
>>> taken:  to me from the web designer point of view it is still the most
>>> clean way to implement the call to tapestry.
>>>       
>> Tapestry 5 haven't really abondened the old syntax, besides $content$ and
>> $remove$, but they're easily replaced with simple components.
>> I guess Howard (Tapestry creator and main developer) just wanted to create
>> another syntax, one that is friendlier with XML editors (namespaces). I
>> never use the <t:componentName> syntax in pages and almost never in
>> components and I'm quite happy with it. :)
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java consultant, developer, and instructor
>> http://www.arsmachina.com.br/thiago
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>     
>
>
>
>   

-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================


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


Re: templates changes from tapestry 4.1 to tapestry 5

Posted by Howard Lewis Ship <hl...@gmail.com>.
A well established Tapestry style in Tap3 + Tap4 was:

<if jwcid="@Conditional" condition="whatever"> ... </if>

I really liked that style, especially for teaching Tapestry and wanted
to allow something that immediately understandable but even more
concise.

On Wed, Mar 4, 2009 at 10:33 AM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> Em Wed, 04 Mar 2009 13:18:46 -0300, Ivano Luberti <lu...@archicoop.it>
> escreveu:
>
>> pheeew !
>> Thanks for the quick answer to all of you.
>
> You're welcome!
>
>> I was afraid I had made one of the biggest mistake in my life.
>
> Maybe you just made one of the best decisions in your life.. :)
>
>> But can you tell me why the choice to abandon the old syntax has been
>> taken:  to me from the web designer point of view it is still the most
>> clean way to implement the call to tapestry.
>
> Tapestry 5 haven't really abondened the old syntax, besides $content$ and
> $remove$, but they're easily replaced with simple components.
> I guess Howard (Tapestry creator and main developer) just wanted to create
> another syntax, one that is friendlier with XML editors (namespaces). I
> never use the <t:componentName> syntax in pages and almost never in
> components and I'm quite happy with it. :)
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: templates changes from tapestry 4.1 to tapestry 5

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 04 Mar 2009 13:18:46 -0300, Ivano Luberti <lu...@archicoop.it>  
escreveu:

> pheeew !
> Thanks for the quick answer to all of you.

You're welcome!

> I was afraid I had made one of the biggest mistake in my life.

Maybe you just made one of the best decisions in your life.. :)

> But can you tell me why the choice to abandon the old syntax has been
> taken:  to me from the web designer point of view it is still the most
> clean way to implement the call to tapestry.

Tapestry 5 haven't really abondened the old syntax, besides $content$ and  
$remove$, but they're easily replaced with simple components.
I guess Howard (Tapestry creator and main developer) just wanted to create  
another syntax, one that is friendlier with XML editors (namespaces). I  
never use the <t:componentName> syntax in pages and almost never in  
components and I'm quite happy with it. :)

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: templates changes from tapestry 4.1 to tapestry 5

Posted by Ivano Luberti <lu...@archicoop.it>.
pheeew !
Thanks for the quick answer to all of you.

I was afraid I had made one of the biggest mistake in my life.

But can you tell me why the choice to abandon the old syntax has been
taken:  to me from the web designer point of view it is still the most
clean way to implement the call to tapestry.


Thiago H. de Paula Figueiredo ha scritto:
> On Wed, Mar 4, 2009 at 11:18 AM, Ivano Luberti <lu...@archicoop.it> wrote:
>   
>> Can someone explain me wether I'm wrong or not ? I really hope I am.
>>     
>
> You're wrong! :D
>
> You can use components using have two different sintaxes:
> <t:componentname> (the one used in most examples) or <div
> t:type="ComponentName"> (the one I use almost exclusively). Take a
> look at the "Invisible instrumentation" section of
> http://tapestry.apache.org/tapestry5/guide/templates.html.
>
>   

-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================


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


Re: templates changes from tapestry 4.1 to tapestry 5

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, Mar 4, 2009 at 11:18 AM, Ivano Luberti <lu...@archicoop.it> wrote:
> Can someone explain me wether I'm wrong or not ? I really hope I am.

You're wrong! :D

You can use components using have two different sintaxes:
<t:componentname> (the one used in most examples) or <div
t:type="ComponentName"> (the one I use almost exclusively). Take a
look at the "Invisible instrumentation" section of
http://tapestry.apache.org/tapestry5/guide/templates.html.

-- 
Thiago

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


Re: templates changes from tapestry 4.1 to tapestry 5

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi,

T5 offers you 3 choices to add components:

1) you can use the t:id attribute (as T4s jwcid)

template:
<a t:id="link">...</a>

class:
@Component
private ActionLik link;

2) invisible instrumentation
<a t:type="actionlink">...</a>

3) component elements
<t:actionlink>...</t:actionlink>

the tutorials use invisible instrumentation and/or component elements 
because
they are easier to understand as you dont have to show the java page 
class.

see also http://tapestry.apache.org/tapestry5/guide/templates.html

g,
kris




Ivano Luberti <lu...@archicoop.it> 
04.03.2009 15:18
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
templates changes from tapestry 4.1 to tapestry 5







Hello I'm new to the mailing list but I have been using Tapestry 4.1
since the end of  last year.
I started recently looking to Tapestry 5 and I've been struck by the
changes made in the html templates.

I had chosen Tapestry because it was component based and because there
was no need to use special syntax in the HTML.
Now it seems to me that the last one is gone.
What I really liked of the 4.1 templates was the fact that, putting all
the presentation logic in the page files, a web graphic designer could
work on the templates without knowing a thing of the underlying system,
even after I have dynamized the content inserting the jwcid attribute in
the relevant HTML tags.

For what I see in the Tapestry 5 tutorial , now I have to use special
tags , like in jsp or any other template engine powered presentation 
layer.

Can someone explain me wether I'm wrong or not ? I really hope I am.




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



templates changes from tapestry 4.1 to tapestry 5

Posted by Ivano Luberti <lu...@archicoop.it>.
Hello I'm new to the mailing list but I have been using Tapestry 4.1
since the end of  last year.
I started recently looking to Tapestry 5 and I've been struck by the
changes made in the html templates.

I had chosen Tapestry because it was component based and because there
was no need to use special syntax in the HTML.
Now it seems to me that the last one is gone.
What I really liked of the 4.1 templates was the fact that, putting all
the presentation logic in the page files, a web graphic designer could
work on the templates without knowing a thing of the underlying system,
even after I have dynamized the content inserting the jwcid attribute in
the relevant HTML tags.

For what I see in the Tapestry 5 tutorial , now I have to use special
tags , like in jsp or any other template engine powered presentation layer.

Can someone explain me wether I'm wrong or not ? I really hope I am.




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


Re: component parameter binding question

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, Mar 4, 2009 at 5:15 AM, dhning <ni...@gmail.com> wrote:

> 1. Do in java
> public Object [] getContextValue() {
>    return new Object[2]{user.id, user.name};
> }

You can also return a List.

-- 
Thiago

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


Re: component parameter binding question

Posted by 丁振波 <ze...@gmail.com>.
Got it! thanks!

----- Original Message ----- 
From: "dhning" <ni...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Wednesday, March 04, 2009 5:28 PM
Subject: Re: component parameter binding question


> welcome:)
>
> Like <t:actionlink t:id="delete" 
> context="contextValue">Delete</t:actionlink>
> Since context is prop binding, it will map getContextValue() method in 
> java.
>
> Thanks,
>
> DH
>
>
> ----- Original Message ----- 
> From: "丁振波" <ze...@gmail.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Wednesday, March 04, 2009 5:23 PM
> Subject: Re: component parameter binding question
>
>
>> Thanks for your reply :)
>>
>> I used 5.0.18 release version. What param should set in tml's context 
>> field
>> when I use the way do in java?
>>
>> <t:parameter name="delete">
>>   <t:actionlink t:id="delete" context="???">Delete</t:actionlink>
>> </t:parameter>
>>
>>
>>
>> ----- Original Message ----- 
>> From: "dhning" <ni...@gmail.com>
>> To: "Tapestry users" <us...@tapestry.apache.org>
>> Sent: Wednesday, March 04, 2009 4:15 PM
>> Subject: Re: component parameter binding question
>>
>>
>>> Are you using latest t5 snapshot or 5.0.X.X release?
>>>
>>> If latest snapshot, just use like context="[user.id,user.name]"
>>> If not, there are 2 ways:
>>> 1. Do in java
>>> public Object [] getContextValue() {
>>>    return new Object[2]{user.id, user.name};
>>> }
>>> 2. Use list binding in t5commons library
>>> http://code.google.com/p/tapestry5-components/
>>>
>>> Thanks
>>>
>>> DH
>>>
>>>
>>> ----- Original Message ----- 
>>> From: "丁振波" <ze...@gmail.com>
>>> To: "Tapestry users" <us...@tapestry.apache.org>
>>> Sent: Wednesday, March 04, 2009 3:34 PM
>>> Subject: component parameter binding question
>>>
>>>
>>>> Hello guys, below is my case code:
>>>>
>>>> <t:parameter name="nameCell">
>>>>   <t:pagelink page="edit" context="user.id">${user.name}</t:pagelink>
>>>> </t:parameter>
>>>>
>>>> my question is, how can I pass mutil param value in context , is there
>>>> any
>>>> format like "user.id; user.name"?
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>> 


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


Re: component parameter binding question

Posted by dhning <ni...@gmail.com>.
welcome:)

Like <t:actionlink t:id="delete" context="contextValue">Delete</t:actionlink>
Since context is prop binding, it will map getContextValue() method in java.

Thanks,

DH


----- Original Message ----- 
From: "丁振波" <ze...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Wednesday, March 04, 2009 5:23 PM
Subject: Re: component parameter binding question


> Thanks for your reply :)
> 
> I used 5.0.18 release version. What param should set in tml's context field 
> when I use the way do in java?
> 
> <t:parameter name="delete">
>   <t:actionlink t:id="delete" context="???">Delete</t:actionlink>
> </t:parameter>
> 
> 
> 
> ----- Original Message ----- 
> From: "dhning" <ni...@gmail.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Wednesday, March 04, 2009 4:15 PM
> Subject: Re: component parameter binding question
> 
> 
>> Are you using latest t5 snapshot or 5.0.X.X release?
>>
>> If latest snapshot, just use like context="[user.id,user.name]"
>> If not, there are 2 ways:
>> 1. Do in java
>> public Object [] getContextValue() {
>>    return new Object[2]{user.id, user.name};
>> }
>> 2. Use list binding in t5commons library 
>> http://code.google.com/p/tapestry5-components/
>>
>> Thanks
>>
>> DH
>>
>>
>> ----- Original Message ----- 
>> From: "丁振波" <ze...@gmail.com>
>> To: "Tapestry users" <us...@tapestry.apache.org>
>> Sent: Wednesday, March 04, 2009 3:34 PM
>> Subject: component parameter binding question
>>
>>
>>> Hello guys, below is my case code:
>>>
>>> <t:parameter name="nameCell">
>>>   <t:pagelink page="edit" context="user.id">${user.name}</t:pagelink>
>>> </t:parameter>
>>>
>>> my question is, how can I pass mutil param value in context , is there 
>>> any
>>> format like "user.id; user.name"?
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: component parameter binding question

Posted by 丁振波 <ze...@gmail.com>.
Thanks for your reply :)

I used 5.0.18 release version. What param should set in tml's context field 
when I use the way do in java?

<t:parameter name="delete">
   <t:actionlink t:id="delete" context="???">Delete</t:actionlink>
</t:parameter>



----- Original Message ----- 
From: "dhning" <ni...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Wednesday, March 04, 2009 4:15 PM
Subject: Re: component parameter binding question


> Are you using latest t5 snapshot or 5.0.X.X release?
>
> If latest snapshot, just use like context="[user.id,user.name]"
> If not, there are 2 ways:
> 1. Do in java
> public Object [] getContextValue() {
>    return new Object[2]{user.id, user.name};
> }
> 2. Use list binding in t5commons library 
> http://code.google.com/p/tapestry5-components/
>
> Thanks
>
> DH
>
>
> ----- Original Message ----- 
> From: "丁振波" <ze...@gmail.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Wednesday, March 04, 2009 3:34 PM
> Subject: component parameter binding question
>
>
>> Hello guys, below is my case code:
>>
>> <t:parameter name="nameCell">
>>   <t:pagelink page="edit" context="user.id">${user.name}</t:pagelink>
>> </t:parameter>
>>
>> my question is, how can I pass mutil param value in context , is there 
>> any
>> format like "user.id; user.name"?
>>
>>
>> ---------------------------------------------------------------------
>> 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: component parameter binding question

Posted by dhning <ni...@gmail.com>.
Are you using latest t5 snapshot or 5.0.X.X release?

If latest snapshot, just use like context="[user.id,user.name]"
If not, there are 2 ways:
1. Do in java
public Object [] getContextValue() {
    return new Object[2]{user.id, user.name};
}
2. Use list binding in t5commons library http://code.google.com/p/tapestry5-components/

Thanks

DH


----- Original Message ----- 
From: "丁振波" <ze...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Wednesday, March 04, 2009 3:34 PM
Subject: component parameter binding question


> Hello guys, below is my case code:
> 
> <t:parameter name="nameCell">
>   <t:pagelink page="edit" context="user.id">${user.name}</t:pagelink>
> </t:parameter>
> 
> my question is, how can I pass mutil param value in context , is there any 
> format like "user.id; user.name"? 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
>

component parameter binding question

Posted by 丁振波 <ze...@gmail.com>.
Hello guys, below is my case code:

<t:parameter name="nameCell">
   <t:pagelink page="edit" context="user.id">${user.name}</t:pagelink>
</t:parameter>

my question is, how can I pass mutil param value in context , is there any 
format like "user.id; user.name"? 


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


Re: Component rendering and parameters binding

Posted by Howard Lewis Ship <hl...@gmail.com>.
Parameters are not JavaBeans properties; they are read/write and
"lazy" as you have now realized. They also do some caching.

Oh, and by the way, you can simplify your component a lot:

<td>ticket?.ticketNumber</td>

The ?. operator encapsulates the null check you were doing in Java code.

Check out the Tapestry 5.0 refcard!

On Tue, Mar 3, 2009 at 1:41 PM, Simon Raveh <si...@icann.org> wrote:
> I figure out what was happening. I think tapestry is doing a lasy bind for parameters and only getting them when thay bean access in the component. The null pointer I've got was related to my internal domain object.
>
> Sorry for the confusion.
>
> Thanks,
> Simon
>
>
> On 3/2/09 9:45 PM, "Simon Raveh" <si...@icann.org> wrote:
>
> Yes but this is in the component template and it is being called before
> tapestry is binding the parameter to the component. If you look at stack
> trace you will see that the call to getTicketNumber() on the component is
> coming before tapestry is calling getTicket()  on the page object to get the
> parameter that need to be  pass to the component
>
> [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate
> [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
> [DEBUG] components.ViewTicket [ENTER] getTicketNumber()
> [DEBUG] pages.Index [ENTER] getTicket()
> [DEBUG] pages.Index [ EXIT] getTicket
>
> My dev environment is:
>
> Mac book pro with Intellij IDEA 8.1 and Apache Tomcat Version 6.0.10 JDK
> 1.5_07. I'm running the project using maven 2.0.10
>
> Thanks,
> Simon
>
>
> On 3/2/09 6:32 PM, "Howard Lewis Ship" <hl...@gmail.com> wrote:
>
>> I'm not sure what the confusion is:
>>
>> <td>${ticketNumber}</td>
>>
>> That's your call to getTicketNumber().
>>
>> On Mon, Mar 2, 2009 at 6:04 PM, Alex Kotchnev <ak...@gmail.com> wrote:
>>> Simon,
>>>   I still can't figure out your dilemma, but I notice something
>>> interesting.. In the stacktrace that you provided, it looks like this time
>>> getStatus() is being called before getTicket..
>>>
>>>   Maybe some of the folks that are more familiar w/ the guts of T5 can look
>>> at this. It doesn't look like this is due to anything you're doing, looks
>>> like a race condition of some type.
>>>
>>>   I think it would be helpful if you provide some more details on the
>>> environment that you run your app in : e.g. JVM version, app server . Btw,
>>> does this happen consistently if you run it on a different box (e.g. I've
>>> had non-tapestry related stuff sometimes behave differently in terms of
>>> threading on a single CPU vs dual core box) ? Maybe you can try different
>>> JVMs as well, just to check that this is not JVM or version specific.
>>>
>>> Cheers,
>>>
>>> Alex kotchnev
>>>
>>> On Mon, Mar 2, 2009 at 4:23 PM, Simon Raveh <si...@icann.org> wrote:
>>>
>>>> Hi,
>>>>
>>>> Thanks for your help.
>>>> I'm still trying to figure out why getTicketNumber() is being called before
>>>> the parameter was set. From debugging this it seems that it is being called
>>>> when the Index page is being render. Bellow you can find a thread dump:
>>>>
>>>> [INFO] Started Jetty Server
>>>> 2009-03-02 13:09:48.951::INFO:  Started
>>>> SelectChannelConnector@0.0.0.0:8080
>>>> [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
>>>> [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
>>>> java.lang.Exception: Stack trace
>>>>    at java.lang.Thread.dumpStack(Thread.java:1224)
>>>>    at
>>>> org.iana.ietf.ticketstatus.components.ViewTicket._$advised$getStatus(ViewTic
>>>> ket.java:36)
>>>> [DEBUG] components.ViewTicket [ENTER] getStatus()
>>>>     at
>>>> org.iana.ietf.ticketstatus.components.ViewTicket$getStatus$invocation_11fc90
>>>> 9007b.invokeAdvisedMethod(ViewTicket$getStatus$invocation_11fc909007b.java)
>>>>    at
>>>> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.pro
>>>> ceed(AbstractComponentMethodInvocation.java:71)
>>>>    at
>>>> org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvic
>>>> e.java:45)
>>>>    at
>>>>
> org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54>>>
> )
>>>>    at
>>>> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.pro
>>>> ceed(AbstractComponentMethodInvocation.java:80)
>>>>    at
>>>> org.iana.ietf.ticketstatus.components.ViewTicket.getStatus(ViewTicket.java)
>>>>    at $PropertyConduit_11fc9056327.get($PropertyConduit_11fc9056327.java)
>>>>    at
>>>> org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:53)
>>>>    at
>>>> org.apache.tapestry5.internal.structure.ExpansionPageElement.render(Expansio
>>>> nPageElement.java:47)
>>>>    at
>>>> org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.j
>>>> ava:72)
>>>>    at
>>>> org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRender
>>>> QueueImpl.java:121)
>>>>    at
>>>> $PageRenderQueue_11fc9056337.render($PageRenderQueue_11fc9056337.java)
>>>>    at
>>>> $PageRenderQueue_11fc905632f.render($PageRenderQueue_11fc905632f.java)
>>>>    at
>>>> org.apache.tapestry5.services.TapestryModule$19.renderMarkup(TapestryModule.
>>>> java:1200)
>>>>    at
>>>> org.apache.tapestry5.services.TapestryModule$29.renderMarkup(TapestryModule.
>>>> java:1580)
>>>>    at
>>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>>    at
>>>> org.apache.tapestry5.services.TapestryModule$28.renderMarkup(TapestryModule.
>>>> java:1561)
>>>>    at
>>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>>    at
>>>> org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.
>>>> java:1543)
>>>>    at
>>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>>    at
>>>> org.apache.tapestry5.services.TapestryModule$26.renderMarkup(TapestryModule.
>>>> java:1525)
>>>>    at
>>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>>    at
>>>> org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.
>>>> java:1495)
>>>>    at
>>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>>    at
>>>> $MarkupRenderer_11fc9056335.renderMarkup($MarkupRenderer_11fc9056335.java)
>>>>    at
>>>> org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMark
>>>> up(PageMarkupRendererImpl.java:64)
>>>>    at
>>>> $PageMarkupRenderer_11fc9056333.renderPageMarkup($PageMarkupRenderer_11fc905
>>>> 6333.java)
>>>>    at
>>>> org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageRe
>>>> sponse(PageResponseRendererImpl.java:57)
>>>>    at
>>>> $PageResponseRenderer_11fc90562f0.renderPageResponse($PageResponseRenderer_1
>>>> 1fc90562f0.java)
>>>>    at
>>>> org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(P
>>>> ageRenderRequestHandlerImpl.java:59)
>>>>    at
>>>> org.apache.tapestry5.services.TapestryModule$35.handle(TapestryModule.java:1
>>>> 779)
>>>>    at
>>>> $PageRenderRequestHandler_11fc90562f1.handle($PageRenderRequestHandler_11fc9
>>>> 0562f1.java)
>>>>    at
>>>> $PageRenderRequestHandler_11fc90562e4.handle($PageRenderRequestHandler_11fc9
>>>> 0562e4.java)
>>>>    at
>>>> org.apache.tapestry5.internal.services.PageRenderDispatcher.process(PageRend
>>>> erDispatcher.java:92)
>>>>    at
>>>> org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRen
>>>> derDispatcher.java:81)
>>>>    at $Dispatcher_11fc90562ea.dispatch($Dispatcher_11fc90562ea.java)
>>>>    at $Dispatcher_11fc90562dd.dispatch($Dispatcher_11fc90562dd.java)
>>>>    at
>>>> org.apache.tapestry5.services.TapestryModule$17.service(TapestryModule.java:
>>>> 1029)
>>>>    at
>>>> org.iana.ietf.ticketstatus.services.AppModule$1.service(AppModule.java:77)
>>>>    at $RequestFilter_11fc90562dc.service($RequestFilter_11fc90562dc.java)
>>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>>    at
>>>> org.apache.tapestry5.internal.services.LocalizationFilter.service(Localizati
>>>> onFilter.java:42)
>>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>>    at
>>>> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErr
>>>> orFilter.java:26)
>>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>>    at
>>>> org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:6
>>>> 21)
>>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>>    at
>>>> org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:6
>>>> 11)
>>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>>    at
>>>> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFiles
>>>> Filter.java:85)
>>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>>    at
>>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckF
>>>> orUpdatesFilter.java:93)
>>>>    at
>>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckF
>>>> orUpdatesFilter.java:84)
>>>>    at
>>>> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(Concurrent
>>>> Barrier.java:83)
>>>>    at
>>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckFo
>>>> rUpdatesFilter.java:106)
>>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>>    at $RequestHandler_11fc90562d4.service($RequestHandler_11fc90562d4.java)
>>>>    at
>>>> org.apache.tapestry5.services.TapestryModule$16.service(TapestryModule.java:
>>>> 1007)
>>>>    at
>>>> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPat
>>>> hsFilter.java:62)
>>>>    at
>>>> $HttpServletRequestFilter_11fc90562d3.service($HttpServletRequestFilter_11fc
>>>> 90562d3.java)
>>>>    at
>>>> $HttpServletRequestHandler_11fc90562d5.service($HttpServletRequestHandler_11
>>>> fc90562d5.java)
>>>>    at
>>>> $HttpServletRequestHandler_11fc90562d2.service($HttpServletRequestHandler_11
>>>> fc90562d2.java)
>>>>    at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:179)
>>>>    at
>>>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler
>>>> .java:1084)
>>>>    at
>>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
>>>>    at
>>>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>>>>    at
>>>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>>>    at
>>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
>>>>    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>>>> [DEBUG] pages.Index [ENTER] getTicket()
>>>>     at
>>>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerColl
>>>> ection.java:206)
>>>>    at
>>>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:11
>>>> 4)
>>>>    at
>>>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>>>    at org.mortbay.jetty.Server.handle(Server.java:324)
>>>>    at
>>>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>>>>    at
>>>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnectio
>>>> n.java:828)
>>>>    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>>>>    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>>>>    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>>>>    at
>>>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>>>>    at
>>>> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:4
>>>> 50)
>>>> [DEBUG] pages.Index [ EXIT] getTicket
>>>> [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@2b60063]
>>>> [DEBUG] components.ViewTicket [ EXIT] getStatus [null]
>>>> [INFO] AppModule.TimingFilter Request time: 1832 ms
>>>>
>>>>
>>>>
>>>>
>>>> On 3/1/09 4:44 AM, "Alex Kotchnev" <ak...@gmail.com> wrote:
>>>>
>>>> Simon,
>>>>   I'm not entirely sure why the getTicketNumber() gets called before the
>>>> ticket gets set, maybe you can put in a break point in the method and look
>>>> at the stack trace and see what's calling it. Just looking at it like this,
>>>> I have no explanation why it's being called.
>>>>
>>>>   On your question of not rendering the component based on its state : it
>>>> seems that it depends on how you want to do it. If this 'don't render
>>>> empty'
>>>> behavior is expected to be a part of the ViewTicket component, you can
>>>> always use a t:if to inspect the state of the ticket in the component
>>>> template render nothing if the ticket is in a state that shouldn't be
>>>> rendered. It seems that the best approach there would be to have 2 blocks :
>>>> one for empty ticket, one for "displayable" ticket, and then use a t:if to
>>>> select which block to render, e.g.
>>>>
>>>> <div id='content'>
>>>>   <t:delegate to='contentBlock' />
>>>> </div>
>>>>
>>>> <t:block t:id="fullContent"> .... </t:block>
>>>> <t:block t:id="emptyBlock"> ...</t:block>
>>>>
>>>>
>>>> ... and then in the component class ...
>>>>
>>>> @Component
>>>> Block fullContent
>>>> @Component
>>>> Block emptyBlock
>>>>
>>>> public Block getContentBlock() {
>>>>    if (this.ticket.foo='bar') {
>>>>      return emptyBlock;
>>>>    }  else {
>>>>      fullContent;
>>>>    }
>>>> }
>>>>
>>>> Something like that.. I haven't tested the exact code above, but I have a
>>>> few similar examples. I think JumpStart (
>>>> http://jumpstart.doublenegative.com.au:8080/jumpstart/) has some examples
>>>> to
>>>> illustrate this but I don't have the exact URL for that.
>>>>
>>>> Cheers,
>>>>
>>>> Alex Kotchnev
>>>>
>>>> On Sun, Mar 1, 2009 at 12:09 AM, Simon Raveh <si...@icann.org>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I'm switching from Tapestry 4 to to Tapestry 5 and I need help with a
>>>>> simple component.
>>>>> I have a component ViewTicket that display Ticket information. The tml
>>>> file
>>>>> code:
>>>>>
>>>>> <t:container xmlns:t="
>>>> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
>>>>> ">
>>>>>    <div style="display: block;" id="output">
>>>>>        <div id="assessment_panel">
>>>>>            <div class="safe" id="box_assessment">
>>>>>                <h2>Ticket Information</h2>
>>>>>            </div>
>>>>>        </div>
>>>>>        <div id="results_panel">
>>>>>            <table id="ns_table">
>>>>>                <tbody>
>>>>>                    <tr>
>>>>>                        <th>Ticket ID</th>
>>>>>                        <th>Status</th>
>>>>>                        <th>Queue</th>
>>>>>                        <th>Created</th>
>>>>>                    </tr>
>>>>>                    <tr>
>>>>>                        <td>${ticketNumber}</td>
>>>>>                        <td>${status}</td>
>>>>>                        <td>${queue}</td>
>>>>>                        <td>${created}</td>
>>>>>                    </tr>
>>>>>                </tbody>
>>>>>            </table>
>>>>>        </div>
>>>>>    </div>
>>>>> </t:container>
>>>>>
>>>>> And the java code
>>>>>
>>>>> public class ViewTicket implements TicketViewer {
>>>>>
>>>>>    @Inject
>>>>>    private Logger logger;
>>>>>
>>>>>    @Parameter(required = true)
>>>>>    private RTTicket ticket;
>>>>>
>>>>>    @Log
>>>>>    @BeforeRenderTemplate
>>>>>    void beforeRenderTamplate(){
>>>>>    }
>>>>>
>>>>>    @Log
>>>>>    public Long getTicketNumber() {
>>>>>        return ticket == null ? null : ticket.getId();
>>>>>    }
>>>>>
>>>>>    @Log
>>>>>    public String getQueue() {
>>>>>        return ticket == null ? null :ticket.getQueue();
>>>>>    }
>>>>>
>>>>>    @Log
>>>>>    public String getStatus() {
>>>>>        return ticket == null ? null :ticket.getStatus();
>>>>>    }
>>>>>
>>>>>    @Log
>>>>>    public Date getCreated() {
>>>>>        return ticket == null ? null : ticket.getCreated();
>>>>>    }
>>>>>
>>>>>    public void addTicket(RTTicket ticket) {
>>>>>       this.ticket = ticket;
>>>>>    }
>>>>>
>>>>>    public void clearTicket() {
>>>>>        this.ticket = new RTTicketImpl();
>>>>>    }
>>>>> }
>>>>> And my page Index.tml
>>>>>
>>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
>>>>> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>>>>> <html t:type="layout" xmlns:t="
>>>>> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>>>>>    <body>
>>>>>        <h1>Request (Ticket) Information</h1>
>>>>>        <p>To check the status of your request, please enter the ticket
>>>>> number (numerical value only) below: </p>
>>>>>        <form t:type="form" t:id="search_form"  action="#">
>>>>>            <t:errors/>
>>>>>                Ticket ID:
>>>>>                <input t:type="TextField" t:id="ticketId"
>>>>> t:clientId="id_query" validate="required"/>
>>>>>                <input type="submit" value="Submit Query"
>>>>> id="form-submit-button"/>
>>>>>         </form>
>>>>>        <span t:type="ViewTicket" t:ticket="prop:ticket" />
>>>>>    </body>
>>>>> </html>
>>>>>
>>>>> Index.java
>>>>>
>>>>> public class Index {
>>>>>
>>>>>    @Inject
>>>>>    private Logger logger;
>>>>>
>>>>>    @Property
>>>>>    private long ticketId;
>>>>>
>>>>>    void onValidateForm() {
>>>>>
>>>>>    }
>>>>>
>>>>>    void onSuccess() {
>>>>>    }
>>>>>
>>>>>    @Log
>>>>>    public RTTicket getTicket() {
>>>>>        return new RTTicketImpl();
>>>>>    }
>>>>> }
>>>>>
>>>>> My problem is that Tapestry is calling the method getTicketNumber before
>>>>> the Ticket parameter is bound.
>>>>> Here are the logging output:
>>>>>
>>>>> [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
>>>>> [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
>>>>> [DEBUG] components.ViewTicket [ENTER] getTicketNumber()
>>>>> [DEBUG] pages.Index [ENTER] getTicket()
>>>>> [DEBUG] pages.Index [ EXIT] getTicket
>>>>> [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@3805fd37]
>>>>> [DEBUG] components.ViewTicket [ EXIT] getTicketNumber [null]
>>>>> [DEBUG] components.ViewTicket [ENTER] getStatus()
>>>>> [DEBUG] components.ViewTicket [ EXIT] getStatus [null]
>>>>> [DEBUG] components.ViewTicket [ENTER] getQueue()
>>>>> [DEBUG] components.ViewTicket [ EXIT] getQueue [null]
>>>>> [DEBUG] components.ViewTicket [ENTER] getCreated()
>>>>> [DEBUG] components.ViewTicket [ EXIT] getCreated [null]
>>>>>
>>>>> Any clue to what I'm doing wrong or help will be much appreciate
>>>>>
>>>>> My second question is what the best way to cause the component ViewTicket
>>>>> not to render base on the state of the ticket it gets as parameter
>>>>>
>>>>> Thanks,
>>>>> Simon
>>>>>
>>>>
>>>>
>>>
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator Apache Tapestry and Apache HiveMind
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: Component rendering and parameters binding

Posted by Simon Raveh <si...@icann.org>.
I figure out what was happening. I think tapestry is doing a lasy bind for parameters and only getting them when thay bean access in the component. The null pointer I've got was related to my internal domain object.

Sorry for the confusion.

Thanks,
Simon


On 3/2/09 9:45 PM, "Simon Raveh" <si...@icann.org> wrote:

Yes but this is in the component template and it is being called before
tapestry is binding the parameter to the component. If you look at stack
trace you will see that the call to getTicketNumber() on the component is
coming before tapestry is calling getTicket()  on the page object to get the
parameter that need to be  pass to the component

[DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate
[DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
[DEBUG] components.ViewTicket [ENTER] getTicketNumber()
[DEBUG] pages.Index [ENTER] getTicket()
[DEBUG] pages.Index [ EXIT] getTicket

My dev environment is:

Mac book pro with Intellij IDEA 8.1 and Apache Tomcat Version 6.0.10 JDK
1.5_07. I'm running the project using maven 2.0.10

Thanks,
Simon


On 3/2/09 6:32 PM, "Howard Lewis Ship" <hl...@gmail.com> wrote:

> I'm not sure what the confusion is:
>
> <td>${ticketNumber}</td>
>
> That's your call to getTicketNumber().
>
> On Mon, Mar 2, 2009 at 6:04 PM, Alex Kotchnev <ak...@gmail.com> wrote:
>> Simon,
>>   I still can't figure out your dilemma, but I notice something
>> interesting.. In the stacktrace that you provided, it looks like this time
>> getStatus() is being called before getTicket..
>>
>>   Maybe some of the folks that are more familiar w/ the guts of T5 can look
>> at this. It doesn't look like this is due to anything you're doing, looks
>> like a race condition of some type.
>>
>>   I think it would be helpful if you provide some more details on the
>> environment that you run your app in : e.g. JVM version, app server . Btw,
>> does this happen consistently if you run it on a different box (e.g. I've
>> had non-tapestry related stuff sometimes behave differently in terms of
>> threading on a single CPU vs dual core box) ? Maybe you can try different
>> JVMs as well, just to check that this is not JVM or version specific.
>>
>> Cheers,
>>
>> Alex kotchnev
>>
>> On Mon, Mar 2, 2009 at 4:23 PM, Simon Raveh <si...@icann.org> wrote:
>>
>>> Hi,
>>>
>>> Thanks for your help.
>>> I'm still trying to figure out why getTicketNumber() is being called before
>>> the parameter was set. From debugging this it seems that it is being called
>>> when the Index page is being render. Bellow you can find a thread dump:
>>>
>>> [INFO] Started Jetty Server
>>> 2009-03-02 13:09:48.951::INFO:  Started
>>> SelectChannelConnector@0.0.0.0:8080
>>> [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
>>> [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
>>> java.lang.Exception: Stack trace
>>>    at java.lang.Thread.dumpStack(Thread.java:1224)
>>>    at
>>> org.iana.ietf.ticketstatus.components.ViewTicket._$advised$getStatus(ViewTic
>>> ket.java:36)
>>> [DEBUG] components.ViewTicket [ENTER] getStatus()
>>>     at
>>> org.iana.ietf.ticketstatus.components.ViewTicket$getStatus$invocation_11fc90
>>> 9007b.invokeAdvisedMethod(ViewTicket$getStatus$invocation_11fc909007b.java)
>>>    at
>>> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.pro
>>> ceed(AbstractComponentMethodInvocation.java:71)
>>>    at
>>> org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvic
>>> e.java:45)
>>>    at
>>>
org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54>>>
)
>>>    at
>>> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.pro
>>> ceed(AbstractComponentMethodInvocation.java:80)
>>>    at
>>> org.iana.ietf.ticketstatus.components.ViewTicket.getStatus(ViewTicket.java)
>>>    at $PropertyConduit_11fc9056327.get($PropertyConduit_11fc9056327.java)
>>>    at
>>> org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:53)
>>>    at
>>> org.apache.tapestry5.internal.structure.ExpansionPageElement.render(Expansio
>>> nPageElement.java:47)
>>>    at
>>> org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.j
>>> ava:72)
>>>    at
>>> org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRender
>>> QueueImpl.java:121)
>>>    at
>>> $PageRenderQueue_11fc9056337.render($PageRenderQueue_11fc9056337.java)
>>>    at
>>> $PageRenderQueue_11fc905632f.render($PageRenderQueue_11fc905632f.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$19.renderMarkup(TapestryModule.
>>> java:1200)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$29.renderMarkup(TapestryModule.
>>> java:1580)
>>>    at
>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$28.renderMarkup(TapestryModule.
>>> java:1561)
>>>    at
>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.
>>> java:1543)
>>>    at
>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$26.renderMarkup(TapestryModule.
>>> java:1525)
>>>    at
>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.
>>> java:1495)
>>>    at
>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>    at
>>> $MarkupRenderer_11fc9056335.renderMarkup($MarkupRenderer_11fc9056335.java)
>>>    at
>>> org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMark
>>> up(PageMarkupRendererImpl.java:64)
>>>    at
>>> $PageMarkupRenderer_11fc9056333.renderPageMarkup($PageMarkupRenderer_11fc905
>>> 6333.java)
>>>    at
>>> org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageRe
>>> sponse(PageResponseRendererImpl.java:57)
>>>    at
>>> $PageResponseRenderer_11fc90562f0.renderPageResponse($PageResponseRenderer_1
>>> 1fc90562f0.java)
>>>    at
>>> org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(P
>>> ageRenderRequestHandlerImpl.java:59)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$35.handle(TapestryModule.java:1
>>> 779)
>>>    at
>>> $PageRenderRequestHandler_11fc90562f1.handle($PageRenderRequestHandler_11fc9
>>> 0562f1.java)
>>>    at
>>> $PageRenderRequestHandler_11fc90562e4.handle($PageRenderRequestHandler_11fc9
>>> 0562e4.java)
>>>    at
>>> org.apache.tapestry5.internal.services.PageRenderDispatcher.process(PageRend
>>> erDispatcher.java:92)
>>>    at
>>> org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRen
>>> derDispatcher.java:81)
>>>    at $Dispatcher_11fc90562ea.dispatch($Dispatcher_11fc90562ea.java)
>>>    at $Dispatcher_11fc90562dd.dispatch($Dispatcher_11fc90562dd.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$17.service(TapestryModule.java:
>>> 1029)
>>>    at
>>> org.iana.ietf.ticketstatus.services.AppModule$1.service(AppModule.java:77)
>>>    at $RequestFilter_11fc90562dc.service($RequestFilter_11fc90562dc.java)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at
>>> org.apache.tapestry5.internal.services.LocalizationFilter.service(Localizati
>>> onFilter.java:42)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at
>>> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErr
>>> orFilter.java:26)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:6
>>> 21)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:6
>>> 11)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at
>>> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFiles
>>> Filter.java:85)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at
>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckF
>>> orUpdatesFilter.java:93)
>>>    at
>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckF
>>> orUpdatesFilter.java:84)
>>>    at
>>> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(Concurrent
>>> Barrier.java:83)
>>>    at
>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckFo
>>> rUpdatesFilter.java:106)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at $RequestHandler_11fc90562d4.service($RequestHandler_11fc90562d4.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$16.service(TapestryModule.java:
>>> 1007)
>>>    at
>>> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPat
>>> hsFilter.java:62)
>>>    at
>>> $HttpServletRequestFilter_11fc90562d3.service($HttpServletRequestFilter_11fc
>>> 90562d3.java)
>>>    at
>>> $HttpServletRequestHandler_11fc90562d5.service($HttpServletRequestHandler_11
>>> fc90562d5.java)
>>>    at
>>> $HttpServletRequestHandler_11fc90562d2.service($HttpServletRequestHandler_11
>>> fc90562d2.java)
>>>    at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:179)
>>>    at
>>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler
>>> .java:1084)
>>>    at
>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
>>>    at
>>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>>>    at
>>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>>    at
>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
>>>    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>>> [DEBUG] pages.Index [ENTER] getTicket()
>>>     at
>>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerColl
>>> ection.java:206)
>>>    at
>>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:11
>>> 4)
>>>    at
>>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>>    at org.mortbay.jetty.Server.handle(Server.java:324)
>>>    at
>>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>>>    at
>>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnectio
>>> n.java:828)
>>>    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>>>    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>>>    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>>>    at
>>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>>>    at
>>> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:4
>>> 50)
>>> [DEBUG] pages.Index [ EXIT] getTicket
>>> [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@2b60063]
>>> [DEBUG] components.ViewTicket [ EXIT] getStatus [null]
>>> [INFO] AppModule.TimingFilter Request time: 1832 ms
>>>
>>>
>>>
>>>
>>> On 3/1/09 4:44 AM, "Alex Kotchnev" <ak...@gmail.com> wrote:
>>>
>>> Simon,
>>>   I'm not entirely sure why the getTicketNumber() gets called before the
>>> ticket gets set, maybe you can put in a break point in the method and look
>>> at the stack trace and see what's calling it. Just looking at it like this,
>>> I have no explanation why it's being called.
>>>
>>>   On your question of not rendering the component based on its state : it
>>> seems that it depends on how you want to do it. If this 'don't render
>>> empty'
>>> behavior is expected to be a part of the ViewTicket component, you can
>>> always use a t:if to inspect the state of the ticket in the component
>>> template render nothing if the ticket is in a state that shouldn't be
>>> rendered. It seems that the best approach there would be to have 2 blocks :
>>> one for empty ticket, one for "displayable" ticket, and then use a t:if to
>>> select which block to render, e.g.
>>>
>>> <div id='content'>
>>>   <t:delegate to='contentBlock' />
>>> </div>
>>>
>>> <t:block t:id="fullContent"> .... </t:block>
>>> <t:block t:id="emptyBlock"> ...</t:block>
>>>
>>>
>>> ... and then in the component class ...
>>>
>>> @Component
>>> Block fullContent
>>> @Component
>>> Block emptyBlock
>>>
>>> public Block getContentBlock() {
>>>    if (this.ticket.foo='bar') {
>>>      return emptyBlock;
>>>    }  else {
>>>      fullContent;
>>>    }
>>> }
>>>
>>> Something like that.. I haven't tested the exact code above, but I have a
>>> few similar examples. I think JumpStart (
>>> http://jumpstart.doublenegative.com.au:8080/jumpstart/) has some examples
>>> to
>>> illustrate this but I don't have the exact URL for that.
>>>
>>> Cheers,
>>>
>>> Alex Kotchnev
>>>
>>> On Sun, Mar 1, 2009 at 12:09 AM, Simon Raveh <si...@icann.org>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm switching from Tapestry 4 to to Tapestry 5 and I need help with a
>>>> simple component.
>>>> I have a component ViewTicket that display Ticket information. The tml
>>> file
>>>> code:
>>>>
>>>> <t:container xmlns:t="
>>> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
>>>> ">
>>>>    <div style="display: block;" id="output">
>>>>        <div id="assessment_panel">
>>>>            <div class="safe" id="box_assessment">
>>>>                <h2>Ticket Information</h2>
>>>>            </div>
>>>>        </div>
>>>>        <div id="results_panel">
>>>>            <table id="ns_table">
>>>>                <tbody>
>>>>                    <tr>
>>>>                        <th>Ticket ID</th>
>>>>                        <th>Status</th>
>>>>                        <th>Queue</th>
>>>>                        <th>Created</th>
>>>>                    </tr>
>>>>                    <tr>
>>>>                        <td>${ticketNumber}</td>
>>>>                        <td>${status}</td>
>>>>                        <td>${queue}</td>
>>>>                        <td>${created}</td>
>>>>                    </tr>
>>>>                </tbody>
>>>>            </table>
>>>>        </div>
>>>>    </div>
>>>> </t:container>
>>>>
>>>> And the java code
>>>>
>>>> public class ViewTicket implements TicketViewer {
>>>>
>>>>    @Inject
>>>>    private Logger logger;
>>>>
>>>>    @Parameter(required = true)
>>>>    private RTTicket ticket;
>>>>
>>>>    @Log
>>>>    @BeforeRenderTemplate
>>>>    void beforeRenderTamplate(){
>>>>    }
>>>>
>>>>    @Log
>>>>    public Long getTicketNumber() {
>>>>        return ticket == null ? null : ticket.getId();
>>>>    }
>>>>
>>>>    @Log
>>>>    public String getQueue() {
>>>>        return ticket == null ? null :ticket.getQueue();
>>>>    }
>>>>
>>>>    @Log
>>>>    public String getStatus() {
>>>>        return ticket == null ? null :ticket.getStatus();
>>>>    }
>>>>
>>>>    @Log
>>>>    public Date getCreated() {
>>>>        return ticket == null ? null : ticket.getCreated();
>>>>    }
>>>>
>>>>    public void addTicket(RTTicket ticket) {
>>>>       this.ticket = ticket;
>>>>    }
>>>>
>>>>    public void clearTicket() {
>>>>        this.ticket = new RTTicketImpl();
>>>>    }
>>>> }
>>>> And my page Index.tml
>>>>
>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
>>>> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>>>> <html t:type="layout" xmlns:t="
>>>> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>>>>    <body>
>>>>        <h1>Request (Ticket) Information</h1>
>>>>        <p>To check the status of your request, please enter the ticket
>>>> number (numerical value only) below: </p>
>>>>        <form t:type="form" t:id="search_form"  action="#">
>>>>            <t:errors/>
>>>>                Ticket ID:
>>>>                <input t:type="TextField" t:id="ticketId"
>>>> t:clientId="id_query" validate="required"/>
>>>>                <input type="submit" value="Submit Query"
>>>> id="form-submit-button"/>
>>>>         </form>
>>>>        <span t:type="ViewTicket" t:ticket="prop:ticket" />
>>>>    </body>
>>>> </html>
>>>>
>>>> Index.java
>>>>
>>>> public class Index {
>>>>
>>>>    @Inject
>>>>    private Logger logger;
>>>>
>>>>    @Property
>>>>    private long ticketId;
>>>>
>>>>    void onValidateForm() {
>>>>
>>>>    }
>>>>
>>>>    void onSuccess() {
>>>>    }
>>>>
>>>>    @Log
>>>>    public RTTicket getTicket() {
>>>>        return new RTTicketImpl();
>>>>    }
>>>> }
>>>>
>>>> My problem is that Tapestry is calling the method getTicketNumber before
>>>> the Ticket parameter is bound.
>>>> Here are the logging output:
>>>>
>>>> [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
>>>> [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
>>>> [DEBUG] components.ViewTicket [ENTER] getTicketNumber()
>>>> [DEBUG] pages.Index [ENTER] getTicket()
>>>> [DEBUG] pages.Index [ EXIT] getTicket
>>>> [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@3805fd37]
>>>> [DEBUG] components.ViewTicket [ EXIT] getTicketNumber [null]
>>>> [DEBUG] components.ViewTicket [ENTER] getStatus()
>>>> [DEBUG] components.ViewTicket [ EXIT] getStatus [null]
>>>> [DEBUG] components.ViewTicket [ENTER] getQueue()
>>>> [DEBUG] components.ViewTicket [ EXIT] getQueue [null]
>>>> [DEBUG] components.ViewTicket [ENTER] getCreated()
>>>> [DEBUG] components.ViewTicket [ EXIT] getCreated [null]
>>>>
>>>> Any clue to what I'm doing wrong or help will be much appreciate
>>>>
>>>> My second question is what the best way to cause the component ViewTicket
>>>> not to render base on the state of the ticket it gets as parameter
>>>>
>>>> Thanks,
>>>> Simon
>>>>
>>>
>>>
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> 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: Component rendering and parameters binding

Posted by Simon Raveh <si...@icann.org>.
Yes but this is in the component template and it is being called before
tapestry is binding the parameter to the component. If you look at stack
trace you will see that the call to getTicketNumber() on the component is
coming before tapestry is calling getTicket()  on the page object to get the
parameter that need to be  pass to the component

[DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate
[DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
[DEBUG] components.ViewTicket [ENTER] getTicketNumber()
[DEBUG] pages.Index [ENTER] getTicket()
[DEBUG] pages.Index [ EXIT] getTicket

My dev environment is:

Mac book pro with Intellij IDEA 8.1 and Apache Tomcat Version 6.0.10 JDK
1.5_07. I'm running the project using maven 2.0.10

Thanks,
Simon


On 3/2/09 6:32 PM, "Howard Lewis Ship" <hl...@gmail.com> wrote:

> I'm not sure what the confusion is:
>
> <td>${ticketNumber}</td>
>
> That's your call to getTicketNumber().
>
> On Mon, Mar 2, 2009 at 6:04 PM, Alex Kotchnev <ak...@gmail.com> wrote:
>> Simon,
>>   I still can't figure out your dilemma, but I notice something
>> interesting.. In the stacktrace that you provided, it looks like this time
>> getStatus() is being called before getTicket..
>>
>>   Maybe some of the folks that are more familiar w/ the guts of T5 can look
>> at this. It doesn't look like this is due to anything you're doing, looks
>> like a race condition of some type.
>>
>>   I think it would be helpful if you provide some more details on the
>> environment that you run your app in : e.g. JVM version, app server . Btw,
>> does this happen consistently if you run it on a different box (e.g. I've
>> had non-tapestry related stuff sometimes behave differently in terms of
>> threading on a single CPU vs dual core box) ? Maybe you can try different
>> JVMs as well, just to check that this is not JVM or version specific.
>>
>> Cheers,
>>
>> Alex kotchnev
>>
>> On Mon, Mar 2, 2009 at 4:23 PM, Simon Raveh <si...@icann.org> wrote:
>>
>>> Hi,
>>>
>>> Thanks for your help.
>>> I'm still trying to figure out why getTicketNumber() is being called before
>>> the parameter was set. From debugging this it seems that it is being called
>>> when the Index page is being render. Bellow you can find a thread dump:
>>>
>>> [INFO] Started Jetty Server
>>> 2009-03-02 13:09:48.951::INFO:  Started
>>> SelectChannelConnector@0.0.0.0:8080
>>> [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
>>> [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
>>> java.lang.Exception: Stack trace
>>>    at java.lang.Thread.dumpStack(Thread.java:1224)
>>>    at
>>> org.iana.ietf.ticketstatus.components.ViewTicket._$advised$getStatus(ViewTic
>>> ket.java:36)
>>> [DEBUG] components.ViewTicket [ENTER] getStatus()
>>>     at
>>> org.iana.ietf.ticketstatus.components.ViewTicket$getStatus$invocation_11fc90
>>> 9007b.invokeAdvisedMethod(ViewTicket$getStatus$invocation_11fc909007b.java)
>>>    at
>>> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.pro
>>> ceed(AbstractComponentMethodInvocation.java:71)
>>>    at
>>> org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvic
>>> e.java:45)
>>>    at
>>>
org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54>>>
)
>>>    at
>>> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.pro
>>> ceed(AbstractComponentMethodInvocation.java:80)
>>>    at
>>> org.iana.ietf.ticketstatus.components.ViewTicket.getStatus(ViewTicket.java)
>>>    at $PropertyConduit_11fc9056327.get($PropertyConduit_11fc9056327.java)
>>>    at
>>> org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:53)
>>>    at
>>> org.apache.tapestry5.internal.structure.ExpansionPageElement.render(Expansio
>>> nPageElement.java:47)
>>>    at
>>> org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.j
>>> ava:72)
>>>    at
>>> org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRender
>>> QueueImpl.java:121)
>>>    at
>>> $PageRenderQueue_11fc9056337.render($PageRenderQueue_11fc9056337.java)
>>>    at
>>> $PageRenderQueue_11fc905632f.render($PageRenderQueue_11fc905632f.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$19.renderMarkup(TapestryModule.
>>> java:1200)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$29.renderMarkup(TapestryModule.
>>> java:1580)
>>>    at
>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$28.renderMarkup(TapestryModule.
>>> java:1561)
>>>    at
>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.
>>> java:1543)
>>>    at
>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$26.renderMarkup(TapestryModule.
>>> java:1525)
>>>    at
>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.
>>> java:1495)
>>>    at
>>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>>    at
>>> $MarkupRenderer_11fc9056335.renderMarkup($MarkupRenderer_11fc9056335.java)
>>>    at
>>> org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMark
>>> up(PageMarkupRendererImpl.java:64)
>>>    at
>>> $PageMarkupRenderer_11fc9056333.renderPageMarkup($PageMarkupRenderer_11fc905
>>> 6333.java)
>>>    at
>>> org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageRe
>>> sponse(PageResponseRendererImpl.java:57)
>>>    at
>>> $PageResponseRenderer_11fc90562f0.renderPageResponse($PageResponseRenderer_1
>>> 1fc90562f0.java)
>>>    at
>>> org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(P
>>> ageRenderRequestHandlerImpl.java:59)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$35.handle(TapestryModule.java:1
>>> 779)
>>>    at
>>> $PageRenderRequestHandler_11fc90562f1.handle($PageRenderRequestHandler_11fc9
>>> 0562f1.java)
>>>    at
>>> $PageRenderRequestHandler_11fc90562e4.handle($PageRenderRequestHandler_11fc9
>>> 0562e4.java)
>>>    at
>>> org.apache.tapestry5.internal.services.PageRenderDispatcher.process(PageRend
>>> erDispatcher.java:92)
>>>    at
>>> org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRen
>>> derDispatcher.java:81)
>>>    at $Dispatcher_11fc90562ea.dispatch($Dispatcher_11fc90562ea.java)
>>>    at $Dispatcher_11fc90562dd.dispatch($Dispatcher_11fc90562dd.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$17.service(TapestryModule.java:
>>> 1029)
>>>    at
>>> org.iana.ietf.ticketstatus.services.AppModule$1.service(AppModule.java:77)
>>>    at $RequestFilter_11fc90562dc.service($RequestFilter_11fc90562dc.java)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at
>>> org.apache.tapestry5.internal.services.LocalizationFilter.service(Localizati
>>> onFilter.java:42)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at
>>> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErr
>>> orFilter.java:26)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:6
>>> 21)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:6
>>> 11)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at
>>> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFiles
>>> Filter.java:85)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at
>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckF
>>> orUpdatesFilter.java:93)
>>>    at
>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckF
>>> orUpdatesFilter.java:84)
>>>    at
>>> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(Concurrent
>>> Barrier.java:83)
>>>    at
>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckFo
>>> rUpdatesFilter.java:106)
>>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>>    at $RequestHandler_11fc90562d4.service($RequestHandler_11fc90562d4.java)
>>>    at
>>> org.apache.tapestry5.services.TapestryModule$16.service(TapestryModule.java:
>>> 1007)
>>>    at
>>> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPat
>>> hsFilter.java:62)
>>>    at
>>> $HttpServletRequestFilter_11fc90562d3.service($HttpServletRequestFilter_11fc
>>> 90562d3.java)
>>>    at
>>> $HttpServletRequestHandler_11fc90562d5.service($HttpServletRequestHandler_11
>>> fc90562d5.java)
>>>    at
>>> $HttpServletRequestHandler_11fc90562d2.service($HttpServletRequestHandler_11
>>> fc90562d2.java)
>>>    at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:179)
>>>    at
>>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler
>>> .java:1084)
>>>    at
>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
>>>    at
>>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>>>    at
>>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>>    at
>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
>>>    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>>> [DEBUG] pages.Index [ENTER] getTicket()
>>>     at
>>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerColl
>>> ection.java:206)
>>>    at
>>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:11
>>> 4)
>>>    at
>>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>>    at org.mortbay.jetty.Server.handle(Server.java:324)
>>>    at
>>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>>>    at
>>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnectio
>>> n.java:828)
>>>    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>>>    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>>>    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>>>    at
>>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>>>    at
>>> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:4
>>> 50)
>>> [DEBUG] pages.Index [ EXIT] getTicket
>>> [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@2b60063]
>>> [DEBUG] components.ViewTicket [ EXIT] getStatus [null]
>>> [INFO] AppModule.TimingFilter Request time: 1832 ms
>>>
>>>
>>>
>>>
>>> On 3/1/09 4:44 AM, "Alex Kotchnev" <ak...@gmail.com> wrote:
>>>
>>> Simon,
>>>   I'm not entirely sure why the getTicketNumber() gets called before the
>>> ticket gets set, maybe you can put in a break point in the method and look
>>> at the stack trace and see what's calling it. Just looking at it like this,
>>> I have no explanation why it's being called.
>>>
>>>   On your question of not rendering the component based on its state : it
>>> seems that it depends on how you want to do it. If this 'don't render
>>> empty'
>>> behavior is expected to be a part of the ViewTicket component, you can
>>> always use a t:if to inspect the state of the ticket in the component
>>> template render nothing if the ticket is in a state that shouldn't be
>>> rendered. It seems that the best approach there would be to have 2 blocks :
>>> one for empty ticket, one for "displayable" ticket, and then use a t:if to
>>> select which block to render, e.g.
>>>
>>> <div id='content'>
>>>   <t:delegate to='contentBlock' />
>>> </div>
>>>
>>> <t:block t:id="fullContent"> .... </t:block>
>>> <t:block t:id="emptyBlock"> ...</t:block>
>>>
>>>
>>> ... and then in the component class ...
>>>
>>> @Component
>>> Block fullContent
>>> @Component
>>> Block emptyBlock
>>>
>>> public Block getContentBlock() {
>>>    if (this.ticket.foo='bar') {
>>>      return emptyBlock;
>>>    }  else {
>>>      fullContent;
>>>    }
>>> }
>>>
>>> Something like that.. I haven't tested the exact code above, but I have a
>>> few similar examples. I think JumpStart (
>>> http://jumpstart.doublenegative.com.au:8080/jumpstart/) has some examples
>>> to
>>> illustrate this but I don't have the exact URL for that.
>>>
>>> Cheers,
>>>
>>> Alex Kotchnev
>>>
>>> On Sun, Mar 1, 2009 at 12:09 AM, Simon Raveh <si...@icann.org>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm switching from Tapestry 4 to to Tapestry 5 and I need help with a
>>>> simple component.
>>>> I have a component ViewTicket that display Ticket information. The tml
>>> file
>>>> code:
>>>>
>>>> <t:container xmlns:t="
>>> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
>>>> ">
>>>>    <div style="display: block;" id="output">
>>>>        <div id="assessment_panel">
>>>>            <div class="safe" id="box_assessment">
>>>>                <h2>Ticket Information</h2>
>>>>            </div>
>>>>        </div>
>>>>        <div id="results_panel">
>>>>            <table id="ns_table">
>>>>                <tbody>
>>>>                    <tr>
>>>>                        <th>Ticket ID</th>
>>>>                        <th>Status</th>
>>>>                        <th>Queue</th>
>>>>                        <th>Created</th>
>>>>                    </tr>
>>>>                    <tr>
>>>>                        <td>${ticketNumber}</td>
>>>>                        <td>${status}</td>
>>>>                        <td>${queue}</td>
>>>>                        <td>${created}</td>
>>>>                    </tr>
>>>>                </tbody>
>>>>            </table>
>>>>        </div>
>>>>    </div>
>>>> </t:container>
>>>>
>>>> And the java code
>>>>
>>>> public class ViewTicket implements TicketViewer {
>>>>
>>>>    @Inject
>>>>    private Logger logger;
>>>>
>>>>    @Parameter(required = true)
>>>>    private RTTicket ticket;
>>>>
>>>>    @Log
>>>>    @BeforeRenderTemplate
>>>>    void beforeRenderTamplate(){
>>>>    }
>>>>
>>>>    @Log
>>>>    public Long getTicketNumber() {
>>>>        return ticket == null ? null : ticket.getId();
>>>>    }
>>>>
>>>>    @Log
>>>>    public String getQueue() {
>>>>        return ticket == null ? null :ticket.getQueue();
>>>>    }
>>>>
>>>>    @Log
>>>>    public String getStatus() {
>>>>        return ticket == null ? null :ticket.getStatus();
>>>>    }
>>>>
>>>>    @Log
>>>>    public Date getCreated() {
>>>>        return ticket == null ? null : ticket.getCreated();
>>>>    }
>>>>
>>>>    public void addTicket(RTTicket ticket) {
>>>>       this.ticket = ticket;
>>>>    }
>>>>
>>>>    public void clearTicket() {
>>>>        this.ticket = new RTTicketImpl();
>>>>    }
>>>> }
>>>> And my page Index.tml
>>>>
>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
>>>> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>>>> <html t:type="layout" xmlns:t="
>>>> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>>>>    <body>
>>>>        <h1>Request (Ticket) Information</h1>
>>>>        <p>To check the status of your request, please enter the ticket
>>>> number (numerical value only) below: </p>
>>>>        <form t:type="form" t:id="search_form"  action="#">
>>>>            <t:errors/>
>>>>                Ticket ID:
>>>>                <input t:type="TextField" t:id="ticketId"
>>>> t:clientId="id_query" validate="required"/>
>>>>                <input type="submit" value="Submit Query"
>>>> id="form-submit-button"/>
>>>>         </form>
>>>>        <span t:type="ViewTicket" t:ticket="prop:ticket" />
>>>>    </body>
>>>> </html>
>>>>
>>>> Index.java
>>>>
>>>> public class Index {
>>>>
>>>>    @Inject
>>>>    private Logger logger;
>>>>
>>>>    @Property
>>>>    private long ticketId;
>>>>
>>>>    void onValidateForm() {
>>>>
>>>>    }
>>>>
>>>>    void onSuccess() {
>>>>    }
>>>>
>>>>    @Log
>>>>    public RTTicket getTicket() {
>>>>        return new RTTicketImpl();
>>>>    }
>>>> }
>>>>
>>>> My problem is that Tapestry is calling the method getTicketNumber before
>>>> the Ticket parameter is bound.
>>>> Here are the logging output:
>>>>
>>>> [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
>>>> [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
>>>> [DEBUG] components.ViewTicket [ENTER] getTicketNumber()
>>>> [DEBUG] pages.Index [ENTER] getTicket()
>>>> [DEBUG] pages.Index [ EXIT] getTicket
>>>> [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@3805fd37]
>>>> [DEBUG] components.ViewTicket [ EXIT] getTicketNumber [null]
>>>> [DEBUG] components.ViewTicket [ENTER] getStatus()
>>>> [DEBUG] components.ViewTicket [ EXIT] getStatus [null]
>>>> [DEBUG] components.ViewTicket [ENTER] getQueue()
>>>> [DEBUG] components.ViewTicket [ EXIT] getQueue [null]
>>>> [DEBUG] components.ViewTicket [ENTER] getCreated()
>>>> [DEBUG] components.ViewTicket [ EXIT] getCreated [null]
>>>>
>>>> Any clue to what I'm doing wrong or help will be much appreciate
>>>>
>>>> My second question is what the best way to cause the component ViewTicket
>>>> not to render base on the state of the ticket it gets as parameter
>>>>
>>>> Thanks,
>>>> Simon
>>>>
>>>
>>>
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> 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: Component rendering and parameters binding

Posted by Howard Lewis Ship <hl...@gmail.com>.
I'm not sure what the confusion is:

<td>${ticketNumber}</td>

That's your call to getTicketNumber().

On Mon, Mar 2, 2009 at 6:04 PM, Alex Kotchnev <ak...@gmail.com> wrote:
> Simon,
>   I still can't figure out your dilemma, but I notice something
> interesting.. In the stacktrace that you provided, it looks like this time
> getStatus() is being called before getTicket..
>
>   Maybe some of the folks that are more familiar w/ the guts of T5 can look
> at this. It doesn't look like this is due to anything you're doing, looks
> like a race condition of some type.
>
>   I think it would be helpful if you provide some more details on the
> environment that you run your app in : e.g. JVM version, app server . Btw,
> does this happen consistently if you run it on a different box (e.g. I've
> had non-tapestry related stuff sometimes behave differently in terms of
> threading on a single CPU vs dual core box) ? Maybe you can try different
> JVMs as well, just to check that this is not JVM or version specific.
>
> Cheers,
>
> Alex kotchnev
>
> On Mon, Mar 2, 2009 at 4:23 PM, Simon Raveh <si...@icann.org> wrote:
>
>> Hi,
>>
>> Thanks for your help.
>> I'm still trying to figure out why getTicketNumber() is being called before
>> the parameter was set. From debugging this it seems that it is being called
>> when the Index page is being render. Bellow you can find a thread dump:
>>
>> [INFO] Started Jetty Server
>> 2009-03-02 13:09:48.951::INFO:  Started
>> SelectChannelConnector@0.0.0.0:8080
>> [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
>> [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
>> java.lang.Exception: Stack trace
>>    at java.lang.Thread.dumpStack(Thread.java:1224)
>>    at
>> org.iana.ietf.ticketstatus.components.ViewTicket._$advised$getStatus(ViewTicket.java:36)
>> [DEBUG] components.ViewTicket [ENTER] getStatus()
>>     at
>> org.iana.ietf.ticketstatus.components.ViewTicket$getStatus$invocation_11fc909007b.invokeAdvisedMethod(ViewTicket$getStatus$invocation_11fc909007b.java)
>>    at
>> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:71)
>>    at
>> org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:45)
>>    at
>> org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
>>    at
>> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:80)
>>    at
>> org.iana.ietf.ticketstatus.components.ViewTicket.getStatus(ViewTicket.java)
>>    at $PropertyConduit_11fc9056327.get($PropertyConduit_11fc9056327.java)
>>    at
>> org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:53)
>>    at
>> org.apache.tapestry5.internal.structure.ExpansionPageElement.render(ExpansionPageElement.java:47)
>>    at
>> org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
>>    at
>> org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121)
>>    at
>> $PageRenderQueue_11fc9056337.render($PageRenderQueue_11fc9056337.java)
>>    at
>> $PageRenderQueue_11fc905632f.render($PageRenderQueue_11fc905632f.java)
>>    at
>> org.apache.tapestry5.services.TapestryModule$19.renderMarkup(TapestryModule.java:1200)
>>    at
>> org.apache.tapestry5.services.TapestryModule$29.renderMarkup(TapestryModule.java:1580)
>>    at
>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>    at
>> org.apache.tapestry5.services.TapestryModule$28.renderMarkup(TapestryModule.java:1561)
>>    at
>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>    at
>> org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.java:1543)
>>    at
>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>    at
>> org.apache.tapestry5.services.TapestryModule$26.renderMarkup(TapestryModule.java:1525)
>>    at
>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>    at
>> org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.java:1495)
>>    at
>> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>>    at
>> $MarkupRenderer_11fc9056335.renderMarkup($MarkupRenderer_11fc9056335.java)
>>    at
>> org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:64)
>>    at
>> $PageMarkupRenderer_11fc9056333.renderPageMarkup($PageMarkupRenderer_11fc9056333.java)
>>    at
>> org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:57)
>>    at
>> $PageResponseRenderer_11fc90562f0.renderPageResponse($PageResponseRenderer_11fc90562f0.java)
>>    at
>> org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:59)
>>    at
>> org.apache.tapestry5.services.TapestryModule$35.handle(TapestryModule.java:1779)
>>    at
>> $PageRenderRequestHandler_11fc90562f1.handle($PageRenderRequestHandler_11fc90562f1.java)
>>    at
>> $PageRenderRequestHandler_11fc90562e4.handle($PageRenderRequestHandler_11fc90562e4.java)
>>    at
>> org.apache.tapestry5.internal.services.PageRenderDispatcher.process(PageRenderDispatcher.java:92)
>>    at
>> org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:81)
>>    at $Dispatcher_11fc90562ea.dispatch($Dispatcher_11fc90562ea.java)
>>    at $Dispatcher_11fc90562dd.dispatch($Dispatcher_11fc90562dd.java)
>>    at
>> org.apache.tapestry5.services.TapestryModule$17.service(TapestryModule.java:1029)
>>    at
>> org.iana.ietf.ticketstatus.services.AppModule$1.service(AppModule.java:77)
>>    at $RequestFilter_11fc90562dc.service($RequestFilter_11fc90562dc.java)
>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>    at
>> org.apache.tapestry5.internal.services.LocalizationFilter.service(LocalizationFilter.java:42)
>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>    at
>> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>    at
>> org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:621)
>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>    at
>> org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:611)
>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>    at
>> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)
>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>    at
>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93)
>>    at
>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:84)
>>    at
>> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:83)
>>    at
>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106)
>>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>>    at $RequestHandler_11fc90562d4.service($RequestHandler_11fc90562d4.java)
>>    at
>> org.apache.tapestry5.services.TapestryModule$16.service(TapestryModule.java:1007)
>>    at
>> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
>>    at
>> $HttpServletRequestFilter_11fc90562d3.service($HttpServletRequestFilter_11fc90562d3.java)
>>    at
>> $HttpServletRequestHandler_11fc90562d5.service($HttpServletRequestHandler_11fc90562d5.java)
>>    at
>> $HttpServletRequestHandler_11fc90562d2.service($HttpServletRequestHandler_11fc90562d2.java)
>>    at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:179)
>>    at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>>    at
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
>>    at
>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>>    at
>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>    at
>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
>>    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>> [DEBUG] pages.Index [ENTER] getTicket()
>>     at
>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
>>    at
>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>>    at
>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>    at org.mortbay.jetty.Server.handle(Server.java:324)
>>    at
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>>    at
>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
>>    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>>    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>>    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>>    at
>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>>    at
>> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
>> [DEBUG] pages.Index [ EXIT] getTicket
>> [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@2b60063]
>> [DEBUG] components.ViewTicket [ EXIT] getStatus [null]
>> [INFO] AppModule.TimingFilter Request time: 1832 ms
>>
>>
>>
>>
>> On 3/1/09 4:44 AM, "Alex Kotchnev" <ak...@gmail.com> wrote:
>>
>> Simon,
>>   I'm not entirely sure why the getTicketNumber() gets called before the
>> ticket gets set, maybe you can put in a break point in the method and look
>> at the stack trace and see what's calling it. Just looking at it like this,
>> I have no explanation why it's being called.
>>
>>   On your question of not rendering the component based on its state : it
>> seems that it depends on how you want to do it. If this 'don't render
>> empty'
>> behavior is expected to be a part of the ViewTicket component, you can
>> always use a t:if to inspect the state of the ticket in the component
>> template render nothing if the ticket is in a state that shouldn't be
>> rendered. It seems that the best approach there would be to have 2 blocks :
>> one for empty ticket, one for "displayable" ticket, and then use a t:if to
>> select which block to render, e.g.
>>
>> <div id='content'>
>>   <t:delegate to='contentBlock' />
>> </div>
>>
>> <t:block t:id="fullContent"> .... </t:block>
>> <t:block t:id="emptyBlock"> ...</t:block>
>>
>>
>> ... and then in the component class ...
>>
>> @Component
>> Block fullContent
>> @Component
>> Block emptyBlock
>>
>> public Block getContentBlock() {
>>    if (this.ticket.foo='bar') {
>>      return emptyBlock;
>>    }  else {
>>      fullContent;
>>    }
>> }
>>
>> Something like that.. I haven't tested the exact code above, but I have a
>> few similar examples. I think JumpStart (
>> http://jumpstart.doublenegative.com.au:8080/jumpstart/) has some examples
>> to
>> illustrate this but I don't have the exact URL for that.
>>
>> Cheers,
>>
>> Alex Kotchnev
>>
>> On Sun, Mar 1, 2009 at 12:09 AM, Simon Raveh <si...@icann.org>
>> wrote:
>>
>> > Hi,
>> >
>> > I'm switching from Tapestry 4 to to Tapestry 5 and I need help with a
>> > simple component.
>> > I have a component ViewTicket that display Ticket information. The tml
>> file
>> > code:
>> >
>> > <t:container xmlns:t="
>> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
>> > ">
>> >    <div style="display: block;" id="output">
>> >        <div id="assessment_panel">
>> >            <div class="safe" id="box_assessment">
>> >                <h2>Ticket Information</h2>
>> >            </div>
>> >        </div>
>> >        <div id="results_panel">
>> >            <table id="ns_table">
>> >                <tbody>
>> >                    <tr>
>> >                        <th>Ticket ID</th>
>> >                        <th>Status</th>
>> >                        <th>Queue</th>
>> >                        <th>Created</th>
>> >                    </tr>
>> >                    <tr>
>> >                        <td>${ticketNumber}</td>
>> >                        <td>${status}</td>
>> >                        <td>${queue}</td>
>> >                        <td>${created}</td>
>> >                    </tr>
>> >                </tbody>
>> >            </table>
>> >        </div>
>> >    </div>
>> > </t:container>
>> >
>> > And the java code
>> >
>> > public class ViewTicket implements TicketViewer {
>> >
>> >    @Inject
>> >    private Logger logger;
>> >
>> >    @Parameter(required = true)
>> >    private RTTicket ticket;
>> >
>> >    @Log
>> >    @BeforeRenderTemplate
>> >    void beforeRenderTamplate(){
>> >    }
>> >
>> >    @Log
>> >    public Long getTicketNumber() {
>> >        return ticket == null ? null : ticket.getId();
>> >    }
>> >
>> >    @Log
>> >    public String getQueue() {
>> >        return ticket == null ? null :ticket.getQueue();
>> >    }
>> >
>> >    @Log
>> >    public String getStatus() {
>> >        return ticket == null ? null :ticket.getStatus();
>> >    }
>> >
>> >    @Log
>> >    public Date getCreated() {
>> >        return ticket == null ? null : ticket.getCreated();
>> >    }
>> >
>> >    public void addTicket(RTTicket ticket) {
>> >       this.ticket = ticket;
>> >    }
>> >
>> >    public void clearTicket() {
>> >        this.ticket = new RTTicketImpl();
>> >    }
>> > }
>> > And my page Index.tml
>> >
>> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
>> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>> > <html t:type="layout" xmlns:t="
>> > http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>> >    <body>
>> >        <h1>Request (Ticket) Information</h1>
>> >        <p>To check the status of your request, please enter the ticket
>> > number (numerical value only) below: </p>
>> >        <form t:type="form" t:id="search_form"  action="#">
>> >            <t:errors/>
>> >                Ticket ID:
>> >                <input t:type="TextField" t:id="ticketId"
>> > t:clientId="id_query" validate="required"/>
>> >                <input type="submit" value="Submit Query"
>> > id="form-submit-button"/>
>> >         </form>
>> >        <span t:type="ViewTicket" t:ticket="prop:ticket" />
>> >    </body>
>> > </html>
>> >
>> > Index.java
>> >
>> > public class Index {
>> >
>> >    @Inject
>> >    private Logger logger;
>> >
>> >    @Property
>> >    private long ticketId;
>> >
>> >    void onValidateForm() {
>> >
>> >    }
>> >
>> >    void onSuccess() {
>> >    }
>> >
>> >    @Log
>> >    public RTTicket getTicket() {
>> >        return new RTTicketImpl();
>> >    }
>> > }
>> >
>> > My problem is that Tapestry is calling the method getTicketNumber before
>> > the Ticket parameter is bound.
>> > Here are the logging output:
>> >
>> > [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
>> > [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
>> > [DEBUG] components.ViewTicket [ENTER] getTicketNumber()
>> > [DEBUG] pages.Index [ENTER] getTicket()
>> > [DEBUG] pages.Index [ EXIT] getTicket
>> > [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@3805fd37]
>> > [DEBUG] components.ViewTicket [ EXIT] getTicketNumber [null]
>> > [DEBUG] components.ViewTicket [ENTER] getStatus()
>> > [DEBUG] components.ViewTicket [ EXIT] getStatus [null]
>> > [DEBUG] components.ViewTicket [ENTER] getQueue()
>> > [DEBUG] components.ViewTicket [ EXIT] getQueue [null]
>> > [DEBUG] components.ViewTicket [ENTER] getCreated()
>> > [DEBUG] components.ViewTicket [ EXIT] getCreated [null]
>> >
>> > Any clue to what I'm doing wrong or help will be much appreciate
>> >
>> > My second question is what the best way to cause the component ViewTicket
>> > not to render base on the state of the ticket it gets as parameter
>> >
>> > Thanks,
>> > Simon
>> >
>>
>>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: Component rendering and parameters binding

Posted by Alex Kotchnev <ak...@gmail.com>.
Simon,
   I still can't figure out your dilemma, but I notice something
interesting.. In the stacktrace that you provided, it looks like this time
getStatus() is being called before getTicket..

   Maybe some of the folks that are more familiar w/ the guts of T5 can look
at this. It doesn't look like this is due to anything you're doing, looks
like a race condition of some type.

   I think it would be helpful if you provide some more details on the
environment that you run your app in : e.g. JVM version, app server . Btw,
does this happen consistently if you run it on a different box (e.g. I've
had non-tapestry related stuff sometimes behave differently in terms of
threading on a single CPU vs dual core box) ? Maybe you can try different
JVMs as well, just to check that this is not JVM or version specific.

Cheers,

Alex kotchnev

On Mon, Mar 2, 2009 at 4:23 PM, Simon Raveh <si...@icann.org> wrote:

> Hi,
>
> Thanks for your help.
> I'm still trying to figure out why getTicketNumber() is being called before
> the parameter was set. From debugging this it seems that it is being called
> when the Index page is being render. Bellow you can find a thread dump:
>
> [INFO] Started Jetty Server
> 2009-03-02 13:09:48.951::INFO:  Started
> SelectChannelConnector@0.0.0.0:8080
> [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
> [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
> java.lang.Exception: Stack trace
>    at java.lang.Thread.dumpStack(Thread.java:1224)
>    at
> org.iana.ietf.ticketstatus.components.ViewTicket._$advised$getStatus(ViewTicket.java:36)
> [DEBUG] components.ViewTicket [ENTER] getStatus()
>     at
> org.iana.ietf.ticketstatus.components.ViewTicket$getStatus$invocation_11fc909007b.invokeAdvisedMethod(ViewTicket$getStatus$invocation_11fc909007b.java)
>    at
> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:71)
>    at
> org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:45)
>    at
> org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
>    at
> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:80)
>    at
> org.iana.ietf.ticketstatus.components.ViewTicket.getStatus(ViewTicket.java)
>    at $PropertyConduit_11fc9056327.get($PropertyConduit_11fc9056327.java)
>    at
> org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:53)
>    at
> org.apache.tapestry5.internal.structure.ExpansionPageElement.render(ExpansionPageElement.java:47)
>    at
> org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
>    at
> org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121)
>    at
> $PageRenderQueue_11fc9056337.render($PageRenderQueue_11fc9056337.java)
>    at
> $PageRenderQueue_11fc905632f.render($PageRenderQueue_11fc905632f.java)
>    at
> org.apache.tapestry5.services.TapestryModule$19.renderMarkup(TapestryModule.java:1200)
>    at
> org.apache.tapestry5.services.TapestryModule$29.renderMarkup(TapestryModule.java:1580)
>    at
> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>    at
> org.apache.tapestry5.services.TapestryModule$28.renderMarkup(TapestryModule.java:1561)
>    at
> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>    at
> org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.java:1543)
>    at
> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>    at
> org.apache.tapestry5.services.TapestryModule$26.renderMarkup(TapestryModule.java:1525)
>    at
> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>    at
> org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.java:1495)
>    at
> $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
>    at
> $MarkupRenderer_11fc9056335.renderMarkup($MarkupRenderer_11fc9056335.java)
>    at
> org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:64)
>    at
> $PageMarkupRenderer_11fc9056333.renderPageMarkup($PageMarkupRenderer_11fc9056333.java)
>    at
> org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:57)
>    at
> $PageResponseRenderer_11fc90562f0.renderPageResponse($PageResponseRenderer_11fc90562f0.java)
>    at
> org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:59)
>    at
> org.apache.tapestry5.services.TapestryModule$35.handle(TapestryModule.java:1779)
>    at
> $PageRenderRequestHandler_11fc90562f1.handle($PageRenderRequestHandler_11fc90562f1.java)
>    at
> $PageRenderRequestHandler_11fc90562e4.handle($PageRenderRequestHandler_11fc90562e4.java)
>    at
> org.apache.tapestry5.internal.services.PageRenderDispatcher.process(PageRenderDispatcher.java:92)
>    at
> org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:81)
>    at $Dispatcher_11fc90562ea.dispatch($Dispatcher_11fc90562ea.java)
>    at $Dispatcher_11fc90562dd.dispatch($Dispatcher_11fc90562dd.java)
>    at
> org.apache.tapestry5.services.TapestryModule$17.service(TapestryModule.java:1029)
>    at
> org.iana.ietf.ticketstatus.services.AppModule$1.service(AppModule.java:77)
>    at $RequestFilter_11fc90562dc.service($RequestFilter_11fc90562dc.java)
>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>    at
> org.apache.tapestry5.internal.services.LocalizationFilter.service(LocalizationFilter.java:42)
>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>    at
> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>    at
> org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:621)
>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>    at
> org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:611)
>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>    at
> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)
>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>    at
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93)
>    at
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:84)
>    at
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:83)
>    at
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106)
>    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
>    at $RequestHandler_11fc90562d4.service($RequestHandler_11fc90562d4.java)
>    at
> org.apache.tapestry5.services.TapestryModule$16.service(TapestryModule.java:1007)
>    at
> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
>    at
> $HttpServletRequestFilter_11fc90562d3.service($HttpServletRequestFilter_11fc90562d3.java)
>    at
> $HttpServletRequestHandler_11fc90562d5.service($HttpServletRequestHandler_11fc90562d5.java)
>    at
> $HttpServletRequestHandler_11fc90562d2.service($HttpServletRequestHandler_11fc90562d2.java)
>    at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:179)
>    at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>    at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
>    at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>    at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>    at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
>    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
> [DEBUG] pages.Index [ENTER] getTicket()
>     at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
>    at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>    at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>    at org.mortbay.jetty.Server.handle(Server.java:324)
>    at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>    at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
>    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>    at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>    at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
> [DEBUG] pages.Index [ EXIT] getTicket
> [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@2b60063]
> [DEBUG] components.ViewTicket [ EXIT] getStatus [null]
> [INFO] AppModule.TimingFilter Request time: 1832 ms
>
>
>
>
> On 3/1/09 4:44 AM, "Alex Kotchnev" <ak...@gmail.com> wrote:
>
> Simon,
>   I'm not entirely sure why the getTicketNumber() gets called before the
> ticket gets set, maybe you can put in a break point in the method and look
> at the stack trace and see what's calling it. Just looking at it like this,
> I have no explanation why it's being called.
>
>   On your question of not rendering the component based on its state : it
> seems that it depends on how you want to do it. If this 'don't render
> empty'
> behavior is expected to be a part of the ViewTicket component, you can
> always use a t:if to inspect the state of the ticket in the component
> template render nothing if the ticket is in a state that shouldn't be
> rendered. It seems that the best approach there would be to have 2 blocks :
> one for empty ticket, one for "displayable" ticket, and then use a t:if to
> select which block to render, e.g.
>
> <div id='content'>
>   <t:delegate to='contentBlock' />
> </div>
>
> <t:block t:id="fullContent"> .... </t:block>
> <t:block t:id="emptyBlock"> ...</t:block>
>
>
> ... and then in the component class ...
>
> @Component
> Block fullContent
> @Component
> Block emptyBlock
>
> public Block getContentBlock() {
>    if (this.ticket.foo='bar') {
>      return emptyBlock;
>    }  else {
>      fullContent;
>    }
> }
>
> Something like that.. I haven't tested the exact code above, but I have a
> few similar examples. I think JumpStart (
> http://jumpstart.doublenegative.com.au:8080/jumpstart/) has some examples
> to
> illustrate this but I don't have the exact URL for that.
>
> Cheers,
>
> Alex Kotchnev
>
> On Sun, Mar 1, 2009 at 12:09 AM, Simon Raveh <si...@icann.org>
> wrote:
>
> > Hi,
> >
> > I'm switching from Tapestry 4 to to Tapestry 5 and I need help with a
> > simple component.
> > I have a component ViewTicket that display Ticket information. The tml
> file
> > code:
> >
> > <t:container xmlns:t="
> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
> > ">
> >    <div style="display: block;" id="output">
> >        <div id="assessment_panel">
> >            <div class="safe" id="box_assessment">
> >                <h2>Ticket Information</h2>
> >            </div>
> >        </div>
> >        <div id="results_panel">
> >            <table id="ns_table">
> >                <tbody>
> >                    <tr>
> >                        <th>Ticket ID</th>
> >                        <th>Status</th>
> >                        <th>Queue</th>
> >                        <th>Created</th>
> >                    </tr>
> >                    <tr>
> >                        <td>${ticketNumber}</td>
> >                        <td>${status}</td>
> >                        <td>${queue}</td>
> >                        <td>${created}</td>
> >                    </tr>
> >                </tbody>
> >            </table>
> >        </div>
> >    </div>
> > </t:container>
> >
> > And the java code
> >
> > public class ViewTicket implements TicketViewer {
> >
> >    @Inject
> >    private Logger logger;
> >
> >    @Parameter(required = true)
> >    private RTTicket ticket;
> >
> >    @Log
> >    @BeforeRenderTemplate
> >    void beforeRenderTamplate(){
> >    }
> >
> >    @Log
> >    public Long getTicketNumber() {
> >        return ticket == null ? null : ticket.getId();
> >    }
> >
> >    @Log
> >    public String getQueue() {
> >        return ticket == null ? null :ticket.getQueue();
> >    }
> >
> >    @Log
> >    public String getStatus() {
> >        return ticket == null ? null :ticket.getStatus();
> >    }
> >
> >    @Log
> >    public Date getCreated() {
> >        return ticket == null ? null : ticket.getCreated();
> >    }
> >
> >    public void addTicket(RTTicket ticket) {
> >       this.ticket = ticket;
> >    }
> >
> >    public void clearTicket() {
> >        this.ticket = new RTTicketImpl();
> >    }
> > }
> > And my page Index.tml
> >
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> > <html t:type="layout" xmlns:t="
> > http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> >    <body>
> >        <h1>Request (Ticket) Information</h1>
> >        <p>To check the status of your request, please enter the ticket
> > number (numerical value only) below: </p>
> >        <form t:type="form" t:id="search_form"  action="#">
> >            <t:errors/>
> >                Ticket ID:
> >                <input t:type="TextField" t:id="ticketId"
> > t:clientId="id_query" validate="required"/>
> >                <input type="submit" value="Submit Query"
> > id="form-submit-button"/>
> >         </form>
> >        <span t:type="ViewTicket" t:ticket="prop:ticket" />
> >    </body>
> > </html>
> >
> > Index.java
> >
> > public class Index {
> >
> >    @Inject
> >    private Logger logger;
> >
> >    @Property
> >    private long ticketId;
> >
> >    void onValidateForm() {
> >
> >    }
> >
> >    void onSuccess() {
> >    }
> >
> >    @Log
> >    public RTTicket getTicket() {
> >        return new RTTicketImpl();
> >    }
> > }
> >
> > My problem is that Tapestry is calling the method getTicketNumber before
> > the Ticket parameter is bound.
> > Here are the logging output:
> >
> > [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
> > [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
> > [DEBUG] components.ViewTicket [ENTER] getTicketNumber()
> > [DEBUG] pages.Index [ENTER] getTicket()
> > [DEBUG] pages.Index [ EXIT] getTicket
> > [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@3805fd37]
> > [DEBUG] components.ViewTicket [ EXIT] getTicketNumber [null]
> > [DEBUG] components.ViewTicket [ENTER] getStatus()
> > [DEBUG] components.ViewTicket [ EXIT] getStatus [null]
> > [DEBUG] components.ViewTicket [ENTER] getQueue()
> > [DEBUG] components.ViewTicket [ EXIT] getQueue [null]
> > [DEBUG] components.ViewTicket [ENTER] getCreated()
> > [DEBUG] components.ViewTicket [ EXIT] getCreated [null]
> >
> > Any clue to what I'm doing wrong or help will be much appreciate
> >
> > My second question is what the best way to cause the component ViewTicket
> > not to render base on the state of the ticket it gets as parameter
> >
> > Thanks,
> > Simon
> >
>
>

Re: Component rendering and parameters binding

Posted by Simon Raveh <si...@icann.org>.
Hi,

Thanks for your help.
I'm still trying to figure out why getTicketNumber() is being called before the parameter was set. From debugging this it seems that it is being called when the Index page is being render. Bellow you can find a thread dump:

[INFO] Started Jetty Server
2009-03-02 13:09:48.951::INFO:  Started SelectChannelConnector@0.0.0.0:8080
[DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
[DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
java.lang.Exception: Stack trace
    at java.lang.Thread.dumpStack(Thread.java:1224)
    at org.iana.ietf.ticketstatus.components.ViewTicket._$advised$getStatus(ViewTicket.java:36)
[DEBUG] components.ViewTicket [ENTER] getStatus()
    at org.iana.ietf.ticketstatus.components.ViewTicket$getStatus$invocation_11fc909007b.invokeAdvisedMethod(ViewTicket$getStatus$invocation_11fc909007b.java)
    at org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:71)
    at org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:45)
    at org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
    at org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:80)
    at org.iana.ietf.ticketstatus.components.ViewTicket.getStatus(ViewTicket.java)
    at $PropertyConduit_11fc9056327.get($PropertyConduit_11fc9056327.java)
    at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:53)
    at org.apache.tapestry5.internal.structure.ExpansionPageElement.render(ExpansionPageElement.java:47)
    at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
    at org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121)
    at $PageRenderQueue_11fc9056337.render($PageRenderQueue_11fc9056337.java)
    at $PageRenderQueue_11fc905632f.render($PageRenderQueue_11fc905632f.java)
    at org.apache.tapestry5.services.TapestryModule$19.renderMarkup(TapestryModule.java:1200)
    at org.apache.tapestry5.services.TapestryModule$29.renderMarkup(TapestryModule.java:1580)
    at $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
    at org.apache.tapestry5.services.TapestryModule$28.renderMarkup(TapestryModule.java:1561)
    at $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
    at org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.java:1543)
    at $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
    at org.apache.tapestry5.services.TapestryModule$26.renderMarkup(TapestryModule.java:1525)
    at $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
    at org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.java:1495)
    at $MarkupRenderer_11fc905633b.renderMarkup($MarkupRenderer_11fc905633b.java)
    at $MarkupRenderer_11fc9056335.renderMarkup($MarkupRenderer_11fc9056335.java)
    at org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:64)
    at $PageMarkupRenderer_11fc9056333.renderPageMarkup($PageMarkupRenderer_11fc9056333.java)
    at org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:57)
    at $PageResponseRenderer_11fc90562f0.renderPageResponse($PageResponseRenderer_11fc90562f0.java)
    at org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:59)
    at org.apache.tapestry5.services.TapestryModule$35.handle(TapestryModule.java:1779)
    at $PageRenderRequestHandler_11fc90562f1.handle($PageRenderRequestHandler_11fc90562f1.java)
    at $PageRenderRequestHandler_11fc90562e4.handle($PageRenderRequestHandler_11fc90562e4.java)
    at org.apache.tapestry5.internal.services.PageRenderDispatcher.process(PageRenderDispatcher.java:92)
    at org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:81)
    at $Dispatcher_11fc90562ea.dispatch($Dispatcher_11fc90562ea.java)
    at $Dispatcher_11fc90562dd.dispatch($Dispatcher_11fc90562dd.java)
    at org.apache.tapestry5.services.TapestryModule$17.service(TapestryModule.java:1029)
    at org.iana.ietf.ticketstatus.services.AppModule$1.service(AppModule.java:77)
    at $RequestFilter_11fc90562dc.service($RequestFilter_11fc90562dc.java)
    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
    at org.apache.tapestry5.internal.services.LocalizationFilter.service(LocalizationFilter.java:42)
    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
    at org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
    at org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:621)
    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
    at org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:611)
    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
    at org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)
    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
    at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93)
    at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:84)
    at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:83)
    at org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106)
    at $RequestHandler_11fc90562de.service($RequestHandler_11fc90562de.java)
    at $RequestHandler_11fc90562d4.service($RequestHandler_11fc90562d4.java)
    at org.apache.tapestry5.services.TapestryModule$16.service(TapestryModule.java:1007)
    at org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
    at $HttpServletRequestFilter_11fc90562d3.service($HttpServletRequestFilter_11fc90562d3.java)
    at $HttpServletRequestHandler_11fc90562d5.service($HttpServletRequestHandler_11fc90562d5.java)
    at $HttpServletRequestHandler_11fc90562d2.service($HttpServletRequestHandler_11fc90562d2.java)
    at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:179)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
[DEBUG] pages.Index [ENTER] getTicket()
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
[DEBUG] pages.Index [ EXIT] getTicket [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@2b60063]
[DEBUG] components.ViewTicket [ EXIT] getStatus [null]
[INFO] AppModule.TimingFilter Request time: 1832 ms




On 3/1/09 4:44 AM, "Alex Kotchnev" <ak...@gmail.com> wrote:

Simon,
   I'm not entirely sure why the getTicketNumber() gets called before the
ticket gets set, maybe you can put in a break point in the method and look
at the stack trace and see what's calling it. Just looking at it like this,
I have no explanation why it's being called.

   On your question of not rendering the component based on its state : it
seems that it depends on how you want to do it. If this 'don't render empty'
behavior is expected to be a part of the ViewTicket component, you can
always use a t:if to inspect the state of the ticket in the component
template render nothing if the ticket is in a state that shouldn't be
rendered. It seems that the best approach there would be to have 2 blocks :
one for empty ticket, one for "displayable" ticket, and then use a t:if to
select which block to render, e.g.

<div id='content'>
   <t:delegate to='contentBlock' />
</div>

<t:block t:id="fullContent"> .... </t:block>
<t:block t:id="emptyBlock"> ...</t:block>


... and then in the component class ...

@Component
Block fullContent
@Component
Block emptyBlock

public Block getContentBlock() {
    if (this.ticket.foo='bar') {
      return emptyBlock;
    }  else {
      fullContent;
    }
}

Something like that.. I haven't tested the exact code above, but I have a
few similar examples. I think JumpStart (
http://jumpstart.doublenegative.com.au:8080/jumpstart/) has some examples to
illustrate this but I don't have the exact URL for that.

Cheers,

Alex Kotchnev

On Sun, Mar 1, 2009 at 12:09 AM, Simon Raveh <si...@icann.org> wrote:

> Hi,
>
> I'm switching from Tapestry 4 to to Tapestry 5 and I need help with a
> simple component.
> I have a component ViewTicket that display Ticket information. The tml file
> code:
>
> <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
> ">
>    <div style="display: block;" id="output">
>        <div id="assessment_panel">
>            <div class="safe" id="box_assessment">
>                <h2>Ticket Information</h2>
>            </div>
>        </div>
>        <div id="results_panel">
>            <table id="ns_table">
>                <tbody>
>                    <tr>
>                        <th>Ticket ID</th>
>                        <th>Status</th>
>                        <th>Queue</th>
>                        <th>Created</th>
>                    </tr>
>                    <tr>
>                        <td>${ticketNumber}</td>
>                        <td>${status}</td>
>                        <td>${queue}</td>
>                        <td>${created}</td>
>                    </tr>
>                </tbody>
>            </table>
>        </div>
>    </div>
> </t:container>
>
> And the java code
>
> public class ViewTicket implements TicketViewer {
>
>    @Inject
>    private Logger logger;
>
>    @Parameter(required = true)
>    private RTTicket ticket;
>
>    @Log
>    @BeforeRenderTemplate
>    void beforeRenderTamplate(){
>    }
>
>    @Log
>    public Long getTicketNumber() {
>        return ticket == null ? null : ticket.getId();
>    }
>
>    @Log
>    public String getQueue() {
>        return ticket == null ? null :ticket.getQueue();
>    }
>
>    @Log
>    public String getStatus() {
>        return ticket == null ? null :ticket.getStatus();
>    }
>
>    @Log
>    public Date getCreated() {
>        return ticket == null ? null : ticket.getCreated();
>    }
>
>    public void addTicket(RTTicket ticket) {
>       this.ticket = ticket;
>    }
>
>    public void clearTicket() {
>        this.ticket = new RTTicketImpl();
>    }
> }
> And my page Index.tml
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html t:type="layout" xmlns:t="
> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>    <body>
>        <h1>Request (Ticket) Information</h1>
>        <p>To check the status of your request, please enter the ticket
> number (numerical value only) below: </p>
>        <form t:type="form" t:id="search_form"  action="#">
>            <t:errors/>
>                Ticket ID:
>                <input t:type="TextField" t:id="ticketId"
> t:clientId="id_query" validate="required"/>
>                <input type="submit" value="Submit Query"
> id="form-submit-button"/>
>         </form>
>        <span t:type="ViewTicket" t:ticket="prop:ticket" />
>    </body>
> </html>
>
> Index.java
>
> public class Index {
>
>    @Inject
>    private Logger logger;
>
>    @Property
>    private long ticketId;
>
>    void onValidateForm() {
>
>    }
>
>    void onSuccess() {
>    }
>
>    @Log
>    public RTTicket getTicket() {
>        return new RTTicketImpl();
>    }
> }
>
> My problem is that Tapestry is calling the method getTicketNumber before
> the Ticket parameter is bound.
> Here are the logging output:
>
> [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
> [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
> [DEBUG] components.ViewTicket [ENTER] getTicketNumber()
> [DEBUG] pages.Index [ENTER] getTicket()
> [DEBUG] pages.Index [ EXIT] getTicket
> [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@3805fd37]
> [DEBUG] components.ViewTicket [ EXIT] getTicketNumber [null]
> [DEBUG] components.ViewTicket [ENTER] getStatus()
> [DEBUG] components.ViewTicket [ EXIT] getStatus [null]
> [DEBUG] components.ViewTicket [ENTER] getQueue()
> [DEBUG] components.ViewTicket [ EXIT] getQueue [null]
> [DEBUG] components.ViewTicket [ENTER] getCreated()
> [DEBUG] components.ViewTicket [ EXIT] getCreated [null]
>
> Any clue to what I'm doing wrong or help will be much appreciate
>
> My second question is what the best way to cause the component ViewTicket
> not to render base on the state of the ticket it gets as parameter
>
> Thanks,
> Simon
>


Re: Component rendering and parameters binding

Posted by Alex Kotchnev <ak...@gmail.com>.
Simon,
   I'm not entirely sure why the getTicketNumber() gets called before the
ticket gets set, maybe you can put in a break point in the method and look
at the stack trace and see what's calling it. Just looking at it like this,
I have no explanation why it's being called.

   On your question of not rendering the component based on its state : it
seems that it depends on how you want to do it. If this 'don't render empty'
behavior is expected to be a part of the ViewTicket component, you can
always use a t:if to inspect the state of the ticket in the component
template render nothing if the ticket is in a state that shouldn't be
rendered. It seems that the best approach there would be to have 2 blocks :
one for empty ticket, one for "displayable" ticket, and then use a t:if to
select which block to render, e.g.

<div id='content'>
   <t:delegate to='contentBlock' />
</div>

<t:block t:id="fullContent"> .... </t:block>
<t:block t:id="emptyBlock"> ...</t:block>


... and then in the component class ...

@Component
Block fullContent
@Component
Block emptyBlock

public Block getContentBlock() {
    if (this.ticket.foo='bar') {
      return emptyBlock;
    }  else {
      fullContent;
    }
}

Something like that.. I haven't tested the exact code above, but I have a
few similar examples. I think JumpStart (
http://jumpstart.doublenegative.com.au:8080/jumpstart/) has some examples to
illustrate this but I don't have the exact URL for that.

Cheers,

Alex Kotchnev

On Sun, Mar 1, 2009 at 12:09 AM, Simon Raveh <si...@icann.org> wrote:

> Hi,
>
> I'm switching from Tapestry 4 to to Tapestry 5 and I need help with a
> simple component.
> I have a component ViewTicket that display Ticket information. The tml file
> code:
>
> <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
> ">
>    <div style="display: block;" id="output">
>        <div id="assessment_panel">
>            <div class="safe" id="box_assessment">
>                <h2>Ticket Information</h2>
>            </div>
>        </div>
>        <div id="results_panel">
>            <table id="ns_table">
>                <tbody>
>                    <tr>
>                        <th>Ticket ID</th>
>                        <th>Status</th>
>                        <th>Queue</th>
>                        <th>Created</th>
>                    </tr>
>                    <tr>
>                        <td>${ticketNumber}</td>
>                        <td>${status}</td>
>                        <td>${queue}</td>
>                        <td>${created}</td>
>                    </tr>
>                </tbody>
>            </table>
>        </div>
>    </div>
> </t:container>
>
> And the java code
>
> public class ViewTicket implements TicketViewer {
>
>    @Inject
>    private Logger logger;
>
>    @Parameter(required = true)
>    private RTTicket ticket;
>
>    @Log
>    @BeforeRenderTemplate
>    void beforeRenderTamplate(){
>    }
>
>    @Log
>    public Long getTicketNumber() {
>        return ticket == null ? null : ticket.getId();
>    }
>
>    @Log
>    public String getQueue() {
>        return ticket == null ? null :ticket.getQueue();
>    }
>
>    @Log
>    public String getStatus() {
>        return ticket == null ? null :ticket.getStatus();
>    }
>
>    @Log
>    public Date getCreated() {
>        return ticket == null ? null : ticket.getCreated();
>    }
>
>    public void addTicket(RTTicket ticket) {
>       this.ticket = ticket;
>    }
>
>    public void clearTicket() {
>        this.ticket = new RTTicketImpl();
>    }
> }
> And my page Index.tml
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html t:type="layout" xmlns:t="
> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>    <body>
>        <h1>Request (Ticket) Information</h1>
>        <p>To check the status of your request, please enter the ticket
> number (numerical value only) below: </p>
>        <form t:type="form" t:id="search_form"  action="#">
>            <t:errors/>
>                Ticket ID:
>                <input t:type="TextField" t:id="ticketId"
> t:clientId="id_query" validate="required"/>
>                <input type="submit" value="Submit Query"
> id="form-submit-button"/>
>         </form>
>        <span t:type="ViewTicket" t:ticket="prop:ticket" />
>    </body>
> </html>
>
> Index.java
>
> public class Index {
>
>    @Inject
>    private Logger logger;
>
>    @Property
>    private long ticketId;
>
>    void onValidateForm() {
>
>    }
>
>    void onSuccess() {
>    }
>
>    @Log
>    public RTTicket getTicket() {
>        return new RTTicketImpl();
>    }
> }
>
> My problem is that Tapestry is calling the method getTicketNumber before
> the Ticket parameter is bound.
> Here are the logging output:
>
> [DEBUG] components.ViewTicket [ENTER] beforeRenderTamplate()
> [DEBUG] components.ViewTicket [ EXIT] beforeRenderTamplate
> [DEBUG] components.ViewTicket [ENTER] getTicketNumber()
> [DEBUG] pages.Index [ENTER] getTicket()
> [DEBUG] pages.Index [ EXIT] getTicket
> [org.iana.ietf.ticketstatus.moodel.RTTicketImpl@3805fd37]
> [DEBUG] components.ViewTicket [ EXIT] getTicketNumber [null]
> [DEBUG] components.ViewTicket [ENTER] getStatus()
> [DEBUG] components.ViewTicket [ EXIT] getStatus [null]
> [DEBUG] components.ViewTicket [ENTER] getQueue()
> [DEBUG] components.ViewTicket [ EXIT] getQueue [null]
> [DEBUG] components.ViewTicket [ENTER] getCreated()
> [DEBUG] components.ViewTicket [ EXIT] getCreated [null]
>
> Any clue to what I'm doing wrong or help will be much appreciate
>
> My second question is what the best way to cause the component ViewTicket
> not to render base on the state of the ticket it gets as parameter
>
> Thanks,
> Simon
>