You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by CG <le...@gmail.com> on 2008/06/10 06:19:19 UTC

T5 : Set dynamic default value for component at pageLoaded but been changed somewhere between beforeRender and afterRender

hi, I am new to Tapestry , no T4 experience at all.

I am facing a problem , I need to set a default value for some
components during loading. Since the default value is not a static
value , I cannot hard coded it in the .java file.

Instead, I assign the value in pageLoaded , however, it does not work.

After doing some study, I found that the value has been assigned
properly to the corresponding private variable in the class , however,
 somewhere in between beforeRender and afterRender , the value has
been changed automatically .


Therefore, I wonder where and how  should I put the code to archieve
such function...

Thanks for all the help ..

CG

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


Re: T5 : Set dynamic default value for component at pageLoaded but been changed somewhere between beforeRender and afterRender

Posted by Josh Canfield <jo...@thedailytube.com>.
It sounds like you don't want to use pageLoaded, that is not called for
every request. You probably want setupRender, or onActivate.

On Sun, Jun 15, 2008 at 12:53 AM, CG <le...@gmail.com> wrote:

> hi josh,
>  thx for your reply , i have solved my problem with 2 variables .
>
> my situation is like this
>
>    Grid at top of page (list) , and bottom is a form  (detail)
>
>   at grid, I have
>     t:row id="abc"
>
>
> and at form , I use value="abc" also
>
> then I initial the value at pageLoaded .
> since t:row also use the same variable , that why the value is
> overwritten during the rendering ..
>
>
>
>
>
>
>
>
> On Wed, Jun 11, 2008 at 12:39 AM, Josh Canfield <jo...@thedailytube.com>
> wrote:
> >> I am facing a problem , I need to set a default value for some
> >> components during loading. Since the default value is not a static
> >> value , I cannot hard coded it in the .java file.
> >
> > You can set the value of your instance properties when they are
> > created or in a default constructor and Tapestry will reset them when
> > it pulls them from the page pool.
> >
> >> After doing some study, I found that the value has been assigned
> >> properly to the corresponding private variable in the class , however,
> >>  somewhere in between beforeRender and afterRender , the value has
> >> been changed automatically .
> >
> > Are you changing the reference and persisting it? If you are then it
> > may get overwritten by the value stored in the session.
> >
> > I believe you can create a setter for the value (if you don't have one
> > already) and put a break point in it to see what is changing it.
> >
> > Josh
> >
> > On Mon, Jun 9, 2008 at 9:19 PM, CG <le...@gmail.com> wrote:
> >> hi, I am new to Tapestry , no T4 experience at all.
> >>
> >> I am facing a problem , I need to set a default value for some
> >> components during loading. Since the default value is not a static
> >> value , I cannot hard coded it in the .java file.
> >>
> >> Instead, I assign the value in pageLoaded , however, it does not work.
> >>
> >> After doing some study, I found that the value has been assigned
> >> properly to the corresponding private variable in the class , however,
> >>  somewhere in between beforeRender and afterRender , the value has
> >> been changed automatically .
> >>
> >>
> >> Therefore, I wonder where and how  should I put the code to archieve
> >> such function...
> >>
> >> Thanks for all the help ..
> >>
> >> CG
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> >
> > --
> > --
> > TheDailyTube.com. Sign up and get the best new videos on the internet
> > delivered fresh to your inbox.
> >
> > ---------------------------------------------------------------------
> > 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
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Re: T5 : Set dynamic default value for component at pageLoaded but been changed somewhere between beforeRender and afterRender

Posted by CG <le...@gmail.com>.
hi josh,
 thx for your reply , i have solved my problem with 2 variables .

my situation is like this

    Grid at top of page (list) , and bottom is a form  (detail)

   at grid, I have
     t:row id="abc"


and at form , I use value="abc" also

then I initial the value at pageLoaded .
since t:row also use the same variable , that why the value is
overwritten during the rendering ..








On Wed, Jun 11, 2008 at 12:39 AM, Josh Canfield <jo...@thedailytube.com> wrote:
>> I am facing a problem , I need to set a default value for some
>> components during loading. Since the default value is not a static
>> value , I cannot hard coded it in the .java file.
>
> You can set the value of your instance properties when they are
> created or in a default constructor and Tapestry will reset them when
> it pulls them from the page pool.
>
>> After doing some study, I found that the value has been assigned
>> properly to the corresponding private variable in the class , however,
>>  somewhere in between beforeRender and afterRender , the value has
>> been changed automatically .
>
> Are you changing the reference and persisting it? If you are then it
> may get overwritten by the value stored in the session.
>
> I believe you can create a setter for the value (if you don't have one
> already) and put a break point in it to see what is changing it.
>
> Josh
>
> On Mon, Jun 9, 2008 at 9:19 PM, CG <le...@gmail.com> wrote:
>> hi, I am new to Tapestry , no T4 experience at all.
>>
>> I am facing a problem , I need to set a default value for some
>> components during loading. Since the default value is not a static
>> value , I cannot hard coded it in the .java file.
>>
>> Instead, I assign the value in pageLoaded , however, it does not work.
>>
>> After doing some study, I found that the value has been assigned
>> properly to the corresponding private variable in the class , however,
>>  somewhere in between beforeRender and afterRender , the value has
>> been changed automatically .
>>
>>
>> Therefore, I wonder where and how  should I put the code to archieve
>> such function...
>>
>> Thanks for all the help ..
>>
>> CG
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
> ---------------------------------------------------------------------
> 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: T5 : Set dynamic default value for component at pageLoaded but been changed somewhere between beforeRender and afterRender

Posted by Josh Canfield <jo...@thedailytube.com>.
> I am facing a problem , I need to set a default value for some
> components during loading. Since the default value is not a static
> value , I cannot hard coded it in the .java file.

You can set the value of your instance properties when they are
created or in a default constructor and Tapestry will reset them when
it pulls them from the page pool.

> After doing some study, I found that the value has been assigned
> properly to the corresponding private variable in the class , however,
>  somewhere in between beforeRender and afterRender , the value has
> been changed automatically .

Are you changing the reference and persisting it? If you are then it
may get overwritten by the value stored in the session.

I believe you can create a setter for the value (if you don't have one
already) and put a break point in it to see what is changing it.

Josh

On Mon, Jun 9, 2008 at 9:19 PM, CG <le...@gmail.com> wrote:
> hi, I am new to Tapestry , no T4 experience at all.
>
> I am facing a problem , I need to set a default value for some
> components during loading. Since the default value is not a static
> value , I cannot hard coded it in the .java file.
>
> Instead, I assign the value in pageLoaded , however, it does not work.
>
> After doing some study, I found that the value has been assigned
> properly to the corresponding private variable in the class , however,
>  somewhere in between beforeRender and afterRender , the value has
> been changed automatically .
>
>
> Therefore, I wonder where and how  should I put the code to archieve
> such function...
>
> Thanks for all the help ..
>
> CG
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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