myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Wessendorf" <mat...@apache.org>
Subject Re: ManagedBean Get and Set Values on Constructor
Date Tue, 25 Apr 2006 16:28:31 GMT
You also should take a look on UISaveState [2]

[2] http://wiki.apache.org/myfaces/SaveState

On 4/25/06, Matthias Wessendorf <matzew@apache.org> wrote:
> Hi Uri,
>
> you can do all the *ugly* parameter handling, but you should go ahead and use
>  <t:updateActionListener/>.
>
>
> For instance you have a grid like
> <h:dataTable var="analysemappe"
> value="#{analysisFolderMaster.analysisfolders}"...>
>
> </h:dataTable>
>
> You could do something like
>
> <h:commandButton
>   value="Details"
>   styleClass="stdButton"
>   action="details">
>
> <t:updateActionListener
>    property="#{analysisFolderDetail.analysisFolder}"
>   value="#{analysemappe}" />
> </h:commandButton>
>
>
>
> This commandButton will navigate you to a *detail* page and passes the
> current grid object (#{analysemappe}) to "analysisFolder"-property of
> the backing bean "analysisFolderDetail".
>
>
> On the detail page you can do stuff like
>
> <h:outputText value="#{analysisFolderDetail.analysisFolder.name}"/>
>
> See also [1] for more. Also you could uses Shale's ViewController.
>
> -Matthias
>
> [1] http://wiki.apache.org/myfaces/ExecutingMethodsFromLinkButtonParameters
>
>
> On 4/25/06, Uri Kalish <ukalish@mercury.com> wrote:
> >
> >
> >
> > We have a page displaying a list of objects.
> >
> > When a user clicks on an object we want to display and edit the object
> > details on another page.
> >
> >
> >
> > So…
> >
> > A user clicks on an object on page1.
> >
> > We save the object id (by java script) to a hidden field on page1 (bound to
> > a field on ManagedBean1) and submit page1.
> >
> > On ManagedBean1 code we navigate to page2.
> >
> > ManagedBean2 gets the id from the field on ManagedBean1 (by facesContext and
> > createValueBinding) and saves it to a field (bound to a hidden field on
> > page2).
> >
> > It happen ON THE CONSTRUCTOR of ManagedBean2 because it needs the object id
> > in order to initialize its fields from the database.
> >
> >
> >
> > Now…
> >
> > If we now want to refresh page2 (e.g. due to some error)… we can't get the
> > id on time (because getting the id is done on the ManagedBean2 constructor
> > before it restores its values from the page).
> >
> >
> >
> > Any ideas regarding best practice for this issue?
> >
> >
> >
> >
> >
> >
> > ______________________________________________________________________
> >  This email has been scanned by the MessageLabs Email Security System.
> >  For more information please visit
> > http://www.messagelabs.com/email
> > ______________________________________________________________________
> >
>
>
> --
> Matthias Wessendorf
> Aechterhoek 18
> 48282 Emsdetten
> http://jroller.com/page/mwessendorf
> mwessendorf-at-gmail-dot-com
>


--
Matthias Wessendorf
Aechterhoek 18
48282 Emsdetten
http://jroller.com/page/mwessendorf
mwessendorf-at-gmail-dot-com

Mime
View raw message