Karthik, i'll try the methods below too.
I guess what i'm trying to understand is the equivalent of a JSP
RequestScope. To me, the component should just "remember" it's value between
pages (and not session scope), but i'm still unclear.

Also in my app below, i don't think the component is really being "shared"
but rather duplicated twice even though it's a component - am I correct in
my own example? I think it may be better to put teh component in a Border
type component itself. I was looking at the Tapestry Petstore example
(implemented in Tap 3 at http://pwp.netcabo.pt/lneves/tapestryapps/). They
have a search component in a border but i don't know if it "persists" it's
search words between page requests. Can anyone find a running demo online
somewhere? 

Confused :-/


karthik.nar wrote:
> 
> glad it worked.
> 
> i think one of the powers of tapestry is the ability to be able to tap
> into
> lifecycle methods, as also register listeners (like pageBeginRender)
> 
> i don't have exact answers to your question "but is this optimal?" - it
> depends on what you want to do.  if you want your component to be agnostic
> of the page it is in, then it's better to follow the approach of the page
> injecting the initial value as done below.
> 
> you could also configure your component to accept a parameter and set that
> as the initial value of the text field.  this parameter could then be
> bound
> to a value on your page.
> 
> hth - karthik.
> 
> 
> On 11/2/06, Gurps <[EMAIL PROTECTED]> wrote:
>>
>>
>> Karthik.Nar,
>>
>> I made the change below to Result.java. It seems to work, but is this
>> optimal? Is there a way for the component to automatically find out it's
>> "parent page" to bind the value without using a "double" bucket brigade
>> and/or without using component injection. I'm new to Tapestry still, so
>> might not understand even what i'm talking about!
>> Is this the best practice? Thank you for your advice.
>>
>> Result.java
>> -------------------
>> package uk.co.gd.dao;
>>
>> import org.apache.tapestry.annotations.InjectComponent;
>> import org.apache.tapestry.event.PageBeginRenderListener;
>> import org.apache.tapestry.event.PageEvent;
>> import org.apache.tapestry.html.BasePage;
>>
>> public abstract class Result extends BasePage implements
>> PageBeginRenderListener {
>>
>>         @InjectComponent("searchComponent")
>>         public abstract SearchComponent getSearchComponent();
>>
>>         public abstract void setSearchText(String searchText);
>>         public abstract String getSearchText();
>>
>>         public void pageBeginRender(PageEvent event) {
>>                 if (event.getRequestCycle().isRewinding()) {
>>                         System.out.println("in pagebeginrender but
>> rewinding");
>>                         return;
>>                 }
>>
>>                 System.out.println("in pagebeginrender not rewinding");
>>
>>                 ((SearchComponent)
>> getSearchComponent()).setSearchText(getSearchText());
>>         }
>> }
>>
>>
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Component-won%27t-remember-value-tf2547494.html#a7142978
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to