Hello,

Here's a really basic question (I'm just a JSF newbie) : list/detail navigation.

It's a pure JSF problem I know, but I think I can perhaps use prerender 
callback to better support a list/detail scenario.

I would like to know if there's a good pattern for list / detail navigation 
without impacting performance (memory, storage
or bandwidth), and with good error handling (dont load data with getters - pb 
if page flush - but with callback method)?

I just wanted to use basic logic : I'll use hidden inputs in master page to 
store my record primary keys, so when
I click on the link, I'll be able to load record details with this pk.

All the following 3 solutions seem to me to be awfull ones (performance 
reasons).
Isn't there another one (a good one) ? Did I miss something ?

And another question : can we use prerender callbacks for this scenario ?

1. Solution 1 just use plain getters
Pb : my business logic is called twice -> show stopper.
My problem with this solution is that if I use dataTable and nested commandLink 
to navigate to detail view, i.e.
<t:dataTable id="userList" var="user">
    <t:column>
        <h:commandLink action="#{userForm.edit}" value="#{user.username}">
            <f:param name="username" value="#{user.username}"/>
        </h:commandLink>
    </t:column>
and my backing bean list if coded as :
public class UserList extends BasePage implements Serializable {
    public List getUsers() {
        List users = userManager.getUsers(null);
        return users;
    }
}

My business logic (userManager) will get called twice (once on RENDER_RESPONSE 
phase, and another
one during postback on APPLY_REQUEST_VALUES phase). 
So I'll got some performance probems.

2. Use t:saveState ou t:dataTable with preserveModel=true
I'll just have to code :
public class UserList extends BasePage implements Serializable {
    private List mUsers = null;
    public List getUsers() {
        if (mUsers == null) {
            mUsers = userManager.getUsers(null);
        } else {
        return mUsers;
    }
}
Pros : 
business logic doesn't get called twice.
Cons : 
jsf context used to serialize table date (if state=client, HTML size ++, if 
state=server then web session clutter).
coding : never forget the condition on getters.

3. Just store my users table on session scope 
Pros : business logic doesn't get called twice.
    I can use prerender to create list data.
Cons : web session clutter.

4. using flashScope
Just read sthing about trinidad flashScope, but doesn"t appear to be a good 
solution, since flashScope will store all
my list data on client or session.

Thank your very much for your help





        
        
                
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com

Reply via email to