JSF передача параметров в выражении метода не удается в компоненте ViewScoped

У меня есть страница JSF, поддерживаемая bean-компонентом ViewScoped, который перечисляет несколько транзакций, как показано ниже


            
                
                      
                        
                      
                
                ...
                ...

                
                    <span class="pagerDBspan" style="font-weight: bold;">
                        
                                    
                            
                            
                            
                                                                                                     
                        
                    </span>                                         
                

когда пользователь переходит на страницу, ссылка имеет accountId, переданный в качестве параметра, который сопоставляется с управляемым свойством в bean-компоненте, как показано ниже

@ManagedProperty("#{param.accountId}")
private int accountId;

в этот момент вызывается метод # {Transactions_byaccount.updateCategory ('', item)}вещь' работает как положено.

пользователь также может изменить идентификатор учетной записи, выбрав раскрывающийся список на странице, которая связана с полем accountId выше, и нажав кнопку обновления, которая вызовет соответствующий DAO, чтобы получить список транзакций выбранной учетной записи. Однако, когда пользователь нажимает кнопку, чтобы вызвать # {Transactions_byaccount.updateCategory ('', item)} не выводит список элементов из новой учетной записи, он использует элемент из списка первой учетной записи.

Похоже, проблема в точке восстановления бит жизненного цикла JSF.

Любая помощь будет оценена. Добавит больше деталей, если это необходимо.

Спасибо Мани

Изменить: мой боб

package applogic.transactions;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.ViewScoped;
import javax.faces.model.SelectItem;

import applogic.Conns;

import finance.bean.TransactionsListBean;
import finance.dao.AccountsDAO;
import finance.dao.TransactionsDAO;
import finance.daobase.BusinessDAO;
import finance.model.Accounts;
import finance.model.Transactions;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@ManagedBean(name = "transactions_byaccount")
@ViewScoped
public class Transactions_Byaccount extends TransactionsListBean implements Serializable {
    List resultList;

    boolean initialized;

    @ManagedProperty("#{param.accountId}")
    private int accountId;

    public SelectItem[] accountsSelections;

    @ManagedProperty("#{param.sortOrder}")
    private int sortOrder;

    public SelectItem[] sortOrderSelections;

    @ManagedProperty("#{param.orderColumn}")
    private int orderColumn;

    public SelectItem[] orderColumnSelections;

    public Transactions_Byaccount() {
         Connection cons = Conns.getConFinanceDB();
         List accountsList = AccountsDAO.List(cons);
         List listOfAccountsSelectItems = new
         ArrayList();

         for( Accounts temp : accountsList ) {
             listOfAccountsSelectItems.add(new SelectItem(temp.getId(), temp.getTitle()));
         }

         accountsSelections = listOfAccountsSelectItems.toArray(new SelectItem[listOfAccountsSelectItems.size()]);

         List sortOrderList = new ArrayList();
         sortOrderList.add(new SelectItem(1, "Asc"));
         sortOrderList.add(new SelectItem(2, "Desc"));       
         sortOrderSelections = sortOrderList.toArray(new SelectItem[sortOrderList.size()]);

         List orderColumnList = new ArrayList();
         orderColumnList.add(new SelectItem(1, "Transaction Date"));
         orderColumnList.add(new SelectItem(2, "Action Date"));      
         orderColumnList.add(new SelectItem(3, "Reconciled Date"));
         orderColumnSelections = orderColumnList.toArray(new SelectItem[orderColumnList.size()]);
    }

    public String updateCategories(String redirectURL) {
        String result = redirectURL;

        Connection cons = Conns.getConFinanceDB();
        for( Transactions temp : (List)this.getPageList() )
            TransactionsDAO.Update(cons, temp);

        resultList = null;

        if( redirectURL != null && redirectURL.length() == 0 )
            redirectURL = null;

        return redirectURL;
    }

    public String updateCategory(String redirectURL, Transactions arg) {
        String result = redirectURL;

        Connection cons = Conns.getConFinanceDB();
        TransactionsDAO.Update(cons, arg);

        resultList = null;

        if( redirectURL != null && redirectURL.length() == 0 )
            redirectURL = null;

        return result;
    }

    @PostConstruct
    public void refresh() {
        Connection con = Conns.getConFinanceDB();
        resultList = TransactionsDAO.ListByaccount(con, accountId, getCurrentPageNo(), getPageSize(), orderColumn, sortOrder);
        initialized = true;

    }

    public void reload() {
        Connection con = Conns.getConFinanceDB();
        resultList = TransactionsDAO.ListByaccount(con, accountId, getCurrentPageNo(), getPageSize(), orderColumn, sortOrder);
        initialized = true;

    }

    public String reload(String returnUrl) {
        Connection con = Conns.getConFinanceDB();
        resultList = TransactionsDAO.ListByaccount(con, accountId, getCurrentPageNo(), getPageSize(), orderColumn, sortOrder);
        initialized = true;     
        return returnUrl;
    }

    public Object getPageList() {


        return resultList;
    }

    public int getMaxCount() {
        Connection con = Conns.getConFinanceDB();
        int result = TransactionsDAO.CountByaccount(con, accountId);
        return result;
    }

    public int getAccountId() {
        return accountId;
    }

    public void setAccountId(int accountId) {
        this.accountId = accountId;
    }

    public SelectItem[] getAccountsSelections() {
        return accountsSelections;
    }

    public void setAccountsSelections(SelectItem[] accountsSelections) {
        this.accountsSelections = accountsSelections;
    }

    public int getSortOrder() {
        return sortOrder;
    }

    public void setSortOrder(int sortOrder) {
        this.sortOrder = sortOrder;
    }

    public SelectItem[] getSortOrderSelections() {
        return sortOrderSelections;
    }

    public void setSortOrderSelections(SelectItem[] sortOrderSelections) {
        this.sortOrderSelections = sortOrderSelections;
    }

    public int getOrderColumn() {
        return orderColumn;
    }

    public void setOrderColumn(int orderColumn) {
        this.orderColumn = orderColumn;
    }

    public SelectItem[] getOrderColumnSelections() {
        return orderColumnSelections;
    }

    public void setOrderColumnSelections(SelectItem[] orderColumnSelections) {
        this.orderColumnSelections = orderColumnSelections;
    }   

    public boolean isInitialized() {
        return initialized;
    }

    public void setInitialized(boolean initialized) {
        this.initialized = initialized;
    }

    public List getResultList() {
        return resultList;
    }

    public void setResultList(List resultList) {
        this.resultList = resultList;
    }
}

А теперь моя страница








    

    
        
            <span>
                
                    
                
            </span>
            <span>
                
                    
                    
                    
                    
                    
                
            </span>         
            <span>
                
                    
                    
                    
                    
                    
                        
            </span>
        
    

    
        
            <span>
                
                    
                        
                        
                        
                                     
                
            </span>
            <span>
                
                    
                        
                        
                        
                        
                

            </span>
                
                    <span style="font-weight: #{item == transactions_byaccount.currentPageNo ? 'bold' : 'lighter' }">
                        
                            
                            
                            
                            
                            

                        
                    </span>
                                

            <span>
                
                    
                        
                        
                        
                        
                
            </span>
            <span>
                
                    
                        
                        
                        
                        

                                
            </span>         
        
        

        
    
    
        
            
                
                    datetransaction
                    description
                    amount
                    Edit
                    Delete
                
            
            
                
                    
                          
                            
                          
                    
                    #{item.description}
                    #{item.amount}
                    
                        <span class="pagerDBspan" style="font-weight: bold;">                   
                            
                                
                                
                                
                            
                        </span>                 
                    
                    
                        <span class="pagerDBspan" style="font-weight: bold;">
                            
                                
                                
                                
                                                                  
                                   
                        </span>                 
                    
                
                
                    
                    
                        
                            
                        
                    
                    
                        <span class="pagerDBspan" style="font-weight: bold;">
                            
                                        
                                
                                
                                
                                                                                                         
                            
                        </span>                                         
                    
                
                
                    
                                   
            
        
    

    
    



Ответы на вопрос(1)

Ваш ответ на вопрос