You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ningdh <ni...@gmail.com> on 2009/03/14 10:14:26 UTC

Re: IF component in tapestry 5 ?

This is not an issueof If component, but due to redirect after post.

In your case, because private String dailyChart, monthlyChart, yearlyChart are not persisted and not in the activation context,
they will be set to default value null.

Solution: add flash persistent strategy like following and have a try:

@Persist("flash")
@Property
private String dailyChart, monthlyChart, yearlyChart ;

Thanks,
DH

----- Original Message ----- 
From: "dwi ardi irawan" 
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Saturday, March 14, 2009 4:19 PM
Subject: Q : IF component in tapestry 5 ?


> guys, i'm so stress with "if" komponent. how to use it
> here's my code
> 
> 
> .tml
> ===========================================
> 
> <t:select t:id="chartType" onchange="this.form.submit()"/>
> 
>    <t:if test="dailyChart">
>    AAA
>    </t:if>
> 
> 
>    <t:if test="monthlyChart">
>    BBB
>    </t:if>
> 
>    <t:if test="yearlyChart">
>    CCC
>    </t:if>
> 
> =============================================
> 
> .java
> =============================================
> 
>   @Persist
>    private ChartType chartType;
> 
>    public ChartType getChartType() {
>        return chartType;
>    }
> 
>    @Property
>    private String dailyChart, monthlyChart, yearlyChart;
> 
>   Object onSuccessFromChartForm(){
> 
>        if(chartType==ChartType.DAILY){
>            dailyChart = "D";
>            monthlyChart = null;
>            yearlyChart = null;
>        }else if (chartType==ChartType.MONTHLY) {
>            dailyChart = null;
>            monthlyChart = "M";
>            yearlyChart = null;
>        }else if (chartType==chartType.YEARLY) {
>            dailyChart = null;
>            monthlyChart = null;
>            yearlyChart = "Y";
>        }
> 
> 
> 
> if we look the code above, it should work but it doesn't
> when i choose "Daily" on select menu that means dailyChart property will
> become "D" and it should render this block and output "AAA"
> <t:if test="dailyChart">
>    AAA
>    </t:if>
> 
> is there something wrong wih my code or my perception of if component in
> tapestry 5
> 
> 
> thnx u
> 
> dwi ardi irawan - 'penyihirkecil'
> http://www.dwiardiirawan.com <http://dwiardiirawan.blogspot.com/>
>

Re: IF component in tapestry 5 ?

Posted by dwi ardi irawan <pe...@gmail.com>.
thnx u for the information....^_^v

Re: IF component in tapestry 5 ?

Posted by ningdh <ni...@gmail.com>.
Hi,

Refer here: http://tapestry.formos.com/nightly/tapestry5/guide/persist.html

Flash field would live in the session not a long time, and will be removed from session after next request (the one after post).

DH
----- Original Message ----- 
From: "dwi ardi irawan" To:
 "Tapestry users" <us...@tapestry.apache.org>
Sent: Saturday, March 14, 2009 9:25 PM
Subject: Re: IF component in tapestry 5 ?


> @Persist("flash")
> 
> what does "flash" mean ??
>

Re: IF component in tapestry 5 ?

Posted by dwi ardi irawan <pe...@gmail.com>.
@Persist("flash")

what does "flash" mean ??

Re: IF component in tapestry 5 ?

Posted by dwi ardi irawan <pe...@gmail.com>.
It Works.....Thnx you

-- 
http://www.dwiardiirawan.com
"cos everyone could be extraordinary...lighten up !"