You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rogerio Pereira <ro...@gmail.com> on 2006/05/03 21:54:32 UTC

Transfering data between pages.

Hi guys,

I have a dataTable on a page and below this page i have a link the opens a
popup window where i can fill a form with some values (eg: an address entry)
and then i click on "Save" button to add this data to dataTable ArrayList
(with addresses), i can do it many times i want before close the window.

Now my question is, how can i refresh the dataTable in the main page with my
populated ArrayList.

I tried this:

        FormProcessoDadosBasicos formProcessoDadosBasicos =
(FormProcessoDadosBasicos) facesContext.getApplication()
        .getVariableResolver().resolveVariable(facesContext,
"formProcessoDadosBasicos");

        EnderecoSentenciado enderecoSentenciado = new EnderecoSentenciado();
        enderecoSentenciado.setLogradouro(descricao);

        if(formProcessoDadosBasicos.getEnderecos() == null)
            formProcessoDadosBasicos.setEnderecos(new ArrayList());

        System.out.println(formProcessoDadosBasicos.getEnderecos().size());

        formProcessoDadosBasicos.getEnderecos().add(enderecoSentenciado);

and then when i close the popup window:

window.opener.document.forms[0].submit(); window.close();

and no effect.

I have another issue, if i close the popup window and open again the
ArrayList is empty.

I'm using jars built form svn.

--
Yours truly (Atenciosamente),

Rogério

Re: Transfering data between pages.

Posted by Rogerio Pereira <ro...@gmail.com>.
On 5/4/06, Mert Çalışkan <mc...@gmail.com> wrote:
>
> You should specify the list as a managed-bean and use the same managed
> bean in main and popup page.
> Other UIComponents should be specified in two different backing-beans.
>

Do you have an example?

--
Yours truly (Atenciosamente),

Rogério

Re: Transfering data between pages.

Posted by Mert Çalışkan <mc...@gmail.com>.
You should specify the list as a managed-bean and use the same managed bean
in main and popup page.
Other UIComponents should be specified in two different backing-beans.

Regards,

Mert


On 5/4/06, Rogerio Pereira <ro...@gmail.com> wrote:
>
>     Yes same managed-bean Rogerio.
> > > I suppose you were adding the results from the bean in popup page to
> > > the bean in main page.
> > >
> >
>
> My problem is, i have 5 fields and 3 buttons on popup window and put this
> stuff in the same bean will make the things a little confuse and dificult to
> understand and manage later.
>
> --
> Yours truly (Atenciosamente),
>
> Rogério
>

Re: Transfering data between pages.

Posted by Rogerio Pereira <ro...@gmail.com>.
>
> Yes same managed-bean Rogerio.
> > I suppose you were adding the results from the bean in popup page to the
> > bean in main page.
> >
>
My problem is, i have 5 fields and 3 buttons on popup window and put this
stuff in the same bean will make the things a little confuse and dificult to
understand and manage later.

--
Yours truly (Atenciosamente),

Rogério

Re: Transfering data between pages.

Posted by Rogerio Pereira <ro...@gmail.com>.
>
> Yes same managed-bean Rogerio.
> I suppose you were adding the results from the bean in popup page to the
> bean in main page.
>

Yes, you is right, but if i use the same managed-bean the things will be
harder to understand later.

--
Yours truly (Atenciosamente),

Rogério

Re: Transfering data between pages.

Posted by Mert Çalışkan <mc...@gmail.com>.
Yes same managed-bean Rogerio.
I suppose you were adding the results from the bean in popup page to the
bean in main page.

Cheers,

Mert


On 5/4/06, Rogerio Pereira <ro...@gmail.com> wrote:
>
>   Use the same list for the main and popup page. Define it as a
> > managed-bean with session scope.
> >
>
> You mean use the same managed-bean in both pages?
>
>
>  After refreshing the main page you should see the address list within the
> > main page.
> > So no need to "add" operations, thx to managed-beans.
> >
>
> What u mean with "add" operations?
>
>
>
>
> --
> Yours truly (Atenciosamente),
>
> Rogério
>

Re: Transfering data between pages.

Posted by Rogerio Pereira <ro...@gmail.com>.
>
> Use the same list for the main and popup page. Define it as a managed-bean
> with session scope.
>

You mean use the same managed-bean in both pages?

After refreshing the main page you should see the address list within the
> main page.
> So no need to "add" operations, thx to managed-beans.
>

What u mean with "add" operations?



--
Yours truly (Atenciosamente),

Rogério

Re: Transfering data between pages.

Posted by Mert Çalışkan <mc...@gmail.com>.
Use the same list for the main and popup page. Define it as a managed-bean
with session scope.

Closing the popup and refreshing the main page could be done with
javascript. But it is related with your main page design.
If you have frames javascript will differ. Assuming one simple main and
popup page (no frames) you should have a link like,

<a href="#" onclick="window.opener.location.reload(); window.close();">Close
Me</a>

After refreshing the main page you should see the address list within the
main page.
So no need to "add" operations, thx to managed-beans.


Regards,

Mert


On 5/3/06, Rogerio Pereira <ro...@gmail.com> wrote:
>
> Hi guys,
>
> I have a dataTable on a page and below this page i have a link the opens a
> popup window where i can fill a form with some values (eg: an address entry)
> and then i click on "Save" button to add this data to dataTable ArrayList
> (with addresses), i can do it many times i want before close the window.
>
> Now my question is, how can i refresh the dataTable in the main page with
> my populated ArrayList.
>
> I tried this:
>
>         FormProcessoDadosBasicos formProcessoDadosBasicos =
> (FormProcessoDadosBasicos) facesContext.getApplication()
>         .getVariableResolver().resolveVariable(facesContext,
> "formProcessoDadosBasicos");
>
>         EnderecoSentenciado enderecoSentenciado = new
> EnderecoSentenciado();
>         enderecoSentenciado.setLogradouro(descricao);
>
>         if(formProcessoDadosBasicos.getEnderecos() == null)
>             formProcessoDadosBasicos.setEnderecos(new ArrayList());
>
>         System.out.println(formProcessoDadosBasicos.getEnderecos
> ().size());
>
>         formProcessoDadosBasicos.getEnderecos().add(enderecoSentenciado);
>
> and then when i close the popup window:
>
> window.opener.document.forms [0].submit(); window.close();
>
> and no effect.
>
> I have another issue, if i close the popup window and open again the
> ArrayList is empty.
>
> I'm using jars built form svn.
>
> --
> Yours truly (Atenciosamente),
>
> Rogério
>