Hi Olle, 

I finally got home and was able to check out your suggestion. 
Works perfectly but I still have a small question:

I also used onActivate() to paste your code and it works as well. 
So my question is: is it big difference between those methods and can both
be used interchangeably or this was only coincidence

Thanks again, I can finally continue on my work.

cheers


Olle Hallin wrote:
> 
> What happens is that TeacherMode is mutable, and hence leaks state between
> different users. You are *not* given a fresh instance on each request.
> Instead, instances are pooled and reused.
> 
> (Starting with 5.0.17,  it is forbidden to have initial values on page
> member variables in order to prevent bugs like this.)
> 
> One way to handle this situation is:
> 
> *...@persist
> *private TeacherMode teacherMode;
> 
> public void *setupRender()* {
>   if (teacherMode == null) {
>     teacherMode = new TeacherMode(); // This will be a private instance
> per
> session
>   }
> }
> 
> HTH,
> 
> Olle
> 
> 
> 2008/12/15 kawes <rafal.kawe...@gmail.com>
> 
>>
>> Hi Jonathan,
>>
>> thanks for your quick response.
>> As you asked I uploaded classes I hit the problem in.
>>
>> Small description: One of my sub-application is Teacher (should be able
>> to
>> provide a word in foreign language and accept user's answer checks
>> wheather
>> it is correct)
>>
>> When user logs in, clicks teacher link is redirected to AvailabaleSets
>> (which is wrapped by TeacherBorder).
>>
>> T5.zip file uploaded and it contains:
>>  - Border.java
>>  - Border.tml (pagelinks to all stuff provided by my app)
>>
>>  - TeacherBorder.java
>>  - TeacherBorder.tml (contains all links to navigate my Teacher
>> sub-application - i.e. TeacherMode - resposnible for 'asking question',
>> registering results etc)
>>
>>  - AvailableSets.java
>>  - AvailableSets.tml (displays available sets containg words)
>>
>>  - TeacherModePage1.java
>>  - TeacherModePage1.tml (lets user to choose the word's set and decide
>> about
>> the questioning mode (mingled or the sequence of words had been added to
>> the
>> set) )
>>
>>  - TeacherModePage2.java
>>  - TeacherModePage2.tml (displays questions and lets to type in answers)
>>
>> TeacherModePage1.java contains the following line:
>>  private TeacherMode teacherMode = new TeacherMode();
>>
>> I belived that when new page would be displayed (whe user clicks
>> TeacherMode
>> in TeacherBorder) a brand new TeacherMode instance would be returned but
>> is
>> not. And is not because all the classes are already instantiated and T5
>> gives them back to the user for efficiency.
>>
>> Please keep in mind this is just the beggining of the work, so not
>> everything is like it should be from architectural point of view (i.e.
>> @Persist will be replaced by onPassvate and onActivate). I just wanted to
>> see how it works.
>>
>> If any more details are reqiured let me know.
>>
>> Thanks in advance http://www.nabble.com/file/p21009484/T5.zip T5.zip
>> --
>> View this message in context:
>> http://www.nabble.com/Layout-Border-component-problem-tp21004400p21009484.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
> 
> 
> -- 
> Olle Hallin
> Senior Java Developer and Architect
> olle.hal...@crisp.se
> www.crisp.se
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Layout-Border-component-problem-tp21004400p21017812.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to