You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Łukasz Budnik <lu...@gmail.com> on 2008/03/09 10:47:44 UTC

general question: assigning/copying variables in view?

Hi All!

I have a problem with redundancy in my web application and I am
looking for a solution
to this problem.

Let's say I have an application to support the librarians. I have
following views: authorDetails.jsf, bookDetails.jsf,
bookOrderDetails.jsf.

All above listed views use the very same HTML elements.
It's huge redundancy, because they differ only by the value attribute
set in outputTexts.
For example, author's first name is retrieved from three different
managed beans:

authorMBean.author.firstName => in authorDetails.jsf
bookMBean.book.author.firstName => in bookDetails.jsf
bookOrderMBean.order.book.author.firstName => bookOrderDetails.jsf

Is there any method in MyFaces to assign /copy a variable like this:

<copy to="authorDetails" from="authorMBean.author" />
<copy to="authorDetails" from="bookOrderMBean.order.book.author" />

so that later on I could include one common JSP and display the
contents of authorDetails variable?

thanks in advance
best regards
Łukasz

Re: general question: assigning/copying variables in view?

Posted by Luka Surija <lu...@iytim.hr>.
Try with

<f:setPropertyActionListener from="#{myvalue}" to="#{myNewValue}" />

Luka Surija

+385 1 61 99 140
+385 98 434 061
luka@iytim.hr

I.Y. tim d.o.o.
Vrbik 3, HR-10000 Zagreb
www.iytim.hr
info@iytim.hr



Łukasz Budnik wrote:
> Hi All!
>
> I have a problem with redundancy in my web application and I am
> looking for a solution
> to this problem.
>
> Let's say I have an application to support the librarians. I have
> following views: authorDetails.jsf, bookDetails.jsf,
> bookOrderDetails.jsf.
>
> All above listed views use the very same HTML elements.
> It's huge redundancy, because they differ only by the value attribute
> set in outputTexts.
> For example, author's first name is retrieved from three different
> managed beans:
>
> authorMBean.author.firstName => in authorDetails.jsf
> bookMBean.book.author.firstName => in bookDetails.jsf
> bookOrderMBean.order.book.author.firstName => bookOrderDetails.jsf
>
> Is there any method in MyFaces to assign /copy a variable like this:
>
> <copy to="authorDetails" from="authorMBean.author" />
> <copy to="authorDetails" from="bookOrderMBean.order.book.author" />
>
> so that later on I could include one common JSP and display the
> contents of authorDetails variable?
>
> thanks in advance
> best regards
> Łukasz
>   

Re: general question: assigning/copying variables in view?

Posted by Łukasz Budnik <lu...@gmail.com>.
Hi Volker,

Thanks, it's great!

best regards
Łukasz

On 09/03/2008, Volker Weber <v....@inexso.de> wrote:
> Hi Łukasz,
>
>  you may look at the tomahawk aliasBean component:
>  http://myfaces.apache.org/tomahawk/aliasBean.html
>
>
>  Regards,
>     Volker
>
>
>
>  2008/3/9, Łukasz Budnik <lu...@gmail.com>:
>
> > Hi All!
>  >
>  >  I have a problem with redundancy in my web application and I am
>  >  looking for a solution
>  >  to this problem.
>  >
>  >  Let's say I have an application to support the librarians. I have
>  >  following views: authorDetails.jsf, bookDetails.jsf,
>  >  bookOrderDetails.jsf.
>  >
>  >  All above listed views use the very same HTML elements.
>  >  It's huge redundancy, because they differ only by the value attribute
>  >  set in outputTexts.
>  >  For example, author's first name is retrieved from three different
>  >  managed beans:
>  >
>  >  authorMBean.author.firstName => in authorDetails.jsf
>  >  bookMBean.book.author.firstName => in bookDetails.jsf
>  >  bookOrderMBean.order.book.author.firstName => bookOrderDetails.jsf
>  >
>  >  Is there any method in MyFaces to assign /copy a variable like this:
>  >
>  >  <copy to="authorDetails" from="authorMBean.author" />
>  >  <copy to="authorDetails" from="bookOrderMBean.order.book.author" />
>  >
>  >  so that later on I could include one common JSP and display the
>  >  contents of authorDetails variable?
>  >
>  >  thanks in advance
>  >  best regards
>  >
>  > Łukasz
>  >
>
>
>
> --
>  inexso - information exchange solutions GmbH
>  Bismarckstraße 13      | 26122 Oldenburg
>  Tel.: +49 441 4082 356 |
>  FAX:  +49 441 4082 355 | www.inexso.de
>

Re: general question: assigning/copying variables in view?

Posted by Volker Weber <v....@inexso.de>.
Hi Łukasz,

you may look at the tomahawk aliasBean component:
http://myfaces.apache.org/tomahawk/aliasBean.html


Regards,
    Volker



2008/3/9, Łukasz Budnik <lu...@gmail.com>:
> Hi All!
>
>  I have a problem with redundancy in my web application and I am
>  looking for a solution
>  to this problem.
>
>  Let's say I have an application to support the librarians. I have
>  following views: authorDetails.jsf, bookDetails.jsf,
>  bookOrderDetails.jsf.
>
>  All above listed views use the very same HTML elements.
>  It's huge redundancy, because they differ only by the value attribute
>  set in outputTexts.
>  For example, author's first name is retrieved from three different
>  managed beans:
>
>  authorMBean.author.firstName => in authorDetails.jsf
>  bookMBean.book.author.firstName => in bookDetails.jsf
>  bookOrderMBean.order.book.author.firstName => bookOrderDetails.jsf
>
>  Is there any method in MyFaces to assign /copy a variable like this:
>
>  <copy to="authorDetails" from="authorMBean.author" />
>  <copy to="authorDetails" from="bookOrderMBean.order.book.author" />
>
>  so that later on I could include one common JSP and display the
>  contents of authorDetails variable?
>
>  thanks in advance
>  best regards
>
> Łukasz
>


-- 
inexso - information exchange solutions GmbH
Bismarckstraße 13      | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX:  +49 441 4082 355 | www.inexso.de