Backing bean method called too often (recursively?)
---------------------------------------------------

                 Key: MYFACES-2239
                 URL: https://issues.apache.org/jira/browse/MYFACES-2239
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 1.2.6, 1.2.5, 1.2.4, 1.2.3
         Environment: linux & windows, but doesn't matter.
(Found in an Appfuse project)
            Reporter: Marcel Rokers


After the save button is pressed a method in the backing bean is called 
(getUser_bos()) to fill the selectManyCheckbox, first time only one time. But 
every time you press save and have selected something it becomes more.

This is to timeconsuming for my project, so I had to go back to 1.2.2, but in 
that version I have another bug that is irritating my project (and is solved in 
1.2.3).

Has anybody a sollution or is this reported before (I didn't find it).

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

<html xmlns="http://www.w3.org/1999/xhtml";

        xmlns:f="http://java.sun.com/jsf/core";

        xmlns:h="http://java.sun.com/jsf/html";>



<body>

        <h:form>

                <h:commandButton id="_save" action="#{bobyUser.save}" 
value="Save" rendered="true" />

                <h:selectManyCheckbox value="#{bobyUser.user_bos}" id="_bo"

                        layout="pageDirection" style="width: 400px; ">

                        <f:selectItems value="#{bobyUser.availableBos}" />

                </h:selectManyCheckbox>

        </h:form>

</body>

</html>

/**
 * Created on 3-may-2007
 * 
 * Revisioninfo from CVS:
 *  $Author: mr $
 *  $Date: 2007-06-04 23:53:30 $
 *  $Revision: 1.4 $
 * 
 */
package com.vgelder.iCorePro.webapp.action;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.faces.model.SelectItem;

/**
 * @author mr
 * 
 */
public class BObyUser implements Serializable {
        private List<String> user_bos = new ArrayList<String>();

        public Collection<SelectItem> getAvailableBos() {
                System.out.println("getAvailableBos");

                List<SelectItem> result = new ArrayList<SelectItem>();
                for (long id = 0; id < 10; id++) {
                        String cid = "" + id;
                        result.add(new SelectItem(cid, "test" + id));
                }
                System.out.println("getUsers returns a list with size=: "
                                + result.size());
                return result;

        }

        public String save() {
                System.out.println("save");
                return "success";
        }

        public List<String> getUser_bos() {
                System.out.println("getUser_bos");
                user_bos.clear();
                for (long id = 0; id < 10; id++) {
                        user_bos.add(id + "");
                }
                System.out.println("getUser_bos: num bos: " + user_bos.size());
                return user_bos;
        }

        public void setUser_bos(final List<String> user_bos) {
                System.out.println("setUser_bos: " + user_bos);
                this.user_bos = user_bos;
        }
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to