Set your private variable to null in your onSuccess function.

On 5/17/08, Manuel Corrales <[EMAIL PROTECTED]> wrote:
> Thanks for your answer, but i still have the same issue. Maybe i am not
> explaining the problem ok. I have a page with a link, when i press the link
> the application goes to the new Matafuego page, where i am using a "hand
> made form" (i mean not using beaneditorform tag). The first time i do this,
> everything works fine, i complete the date press Save and the application
> redirects to the main page again. But the second time i press the link to
> add a new Matafuego, the form has the data i complete on the first one. The
> behavior i am looking here, is that each time i access the form, i create a
> new Matafuego, i mean a clean form and a new Matafuego instance.
>
> Thanks in advance.
>
> On Sat, May 17, 2008 at 11:54 AM, Kevin Menard <[EMAIL PROTECTED]>
> wrote:
>
>> I would probably use a lazy getter with a @Persist attached to the field.
>>
>> Something like:
>>
>> @Persist
>> private Matafuego matafuego;
>>
>> public Metafuego getMetafuego()
>> {
>>   if (null == metafuego)
>>   {
>>       metafuego = new Metafuego();
>>   }
>>
>>   return metafuego;
>> }
>>
>> The page instance is guaranteed to be accessed by only a single thread at
>> a
>> time, so that should be safe for you.
>>
>> --
>> Kevin
>>
>>
>> On 5/17/08 10:01 AM, "Manuel Corrales" <[EMAIL PROTECTED]> wrote:
>>
>> > Hi, here is my problem. I have a bean on my java page, but i am not
>> > using
>> > the beaneditorform component to create a new one. Acording to Alexander
>> > book, the beaneditorform component can handle the initialization of the
>> > bean, so you dont have to create one. As i am not using this component,
>> > should i define the bean with a sentence like this:
>> >
>> > private Matafuego matafuego = new Matafuego();
>> >
>> > or should i create the new instance on the onActivate method?
>> >
>> > I tryied the first approach, but the bean is always the same (i guess
>> > because of the page pooling mechanism). What is the right approach to
>> this?
>> >
>> > Thanks very much.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>


-- 
njl

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

Reply via email to