Hi Frank, thank for sharing your approach.
I see that use setActionListener to refresh an entire bean from your
list one. I immagine that you use directly this bean in your edit page
(if not, why pass all the bean instead of only the identifier
property?).
This is an interesting approach, but I see two problems. The first is
that your list has to be based on the very same javabean you use for
edit (no fields taken from other related tables or calculated fields
in the query). The second is the risk that the user works on
out-of-date data. For these reasons, I'm more orientend towards a
"pass the ID and load the detail" solution.
Anyway, +1 for setActionListener. Next? :-)
2006/5/30, Frank Felix Debatin <[EMAIL PROTECTED]>:
We're using <af:setActionListener> consistently, doing
things like:
<af:table var="item">
...
<af:column>
<af:commandLink ...>
<af:setActionListener from="#{item}"
to="#{EditItem.item}"/>
</af:commandLink>
</af:column>
</af:table>
All in all nice.
If I would need to start from scratch, I'd probably use a
facelets custom EL function like this:
<af:commandLink action="my:invoke('page', item)"/>
where my:invoke stores the parameter in some kind of hash
map for later retrieval. Or the backing bean base class has
an overridable invoke(Object obj) method, or similar.
Regards
Frank Felix
> -----Original Message-----
> From: Cosma Colanicchia [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 30, 2006 3:16 PM
> To: MyFaces Discussion
> Subject: f:param, updateActionListener, pageFlowScope,
> getCurrentRowData.. which design for CRUD with JSF?
>
> Hi,
>
> I've been experimenting JSF for my company for some weeks
by
> now. I'd like to discuss with you about the different ways
> the framework allows for passing parameters between views,
> which is a primary requirements for CRUD operations. I've
> tried many, each one with advantages and
> drawbacks:
>
> 1) Nesting an <f:param> inside the UICommand
> Problems: doesn't work with redirects, need to access an
> "ExternalContext" to retrieve the value
>
> 2) Nesting an <t:updateActionListener> (or a
> <af:setActionListener>) updating a backing bean property
> Problems: requires to create a property on a backing bean
> only for passing the parameter
>
> 3) Using the PageFlowScope of ADF Faces
> Problems: the target action has to be part of dialog (or
to start one)
>
> 4) Getting the current row from a custom DataModel (or
> CollectionModel for ADF Faces)
> Problems: it can be used only when the source of the
action
> is an UICommand inside a data table
>
> Am I missing something? What do you thing about those
> methods? Which one do you prefer? I know that each one is
> better for some situation, but I'd like to adopt a
consistent
> scheme across my application, to simplify maintenance and
to
> be able to recycle some view by defining a standard
interface.
>
> I'd like very much to hear your opinion.
>
> Cosma
>