0

学生のリストを含むアコーディオンパネルがあり、dynamic = "true"を設定しました。アコーディオンパネルのタブに、バッキングBeanのメソッドを呼び出すコマンドボタンがあります。ここでは、最初のタブの内容は空で、残りはすべて問題ありません。これを修正するために、dynamic = "false"を設定しました。タブのコンテンツが表示されていますが、コマンドボタンのクリックでは、最初のクリックでBeanをバッキングするメソッドが呼び出されません。何が起こっているのかわかりません。プライムフェイス3.4とjsf2を使用しています。

<p:accordionPanel  value="#{testBean.students}" var="stud"  dynamic="true"  activeIndex="#{systemManagedBean.formBean.id}">  

              <p:tab title="#{stud.name}" id="studId">  
             <p:commandButton process="@this"  value="edit" icon="ui-icon-pencil" styleClass="btn-primary" style="margin-left:734px;" action="#{testBean.edit}">

            <f:setPropertyActionListener target="#{testBean.stydent}" value="#{stud}"></f:setPropertyActionListener>

            </p:commandButton> 

私はproceess=@formを試しましたが何も変更されませんでした。

4

1 に答える 1

0

次のコードが機能しています。

xhtml:

<h:form>
    <p:accordionPanel value="#{so15320248.students}" var="student">
        <p:tab title="#{student.name}">
            <p:commandButton icon="ui-icon-pencil" value="Edit" actionListener="#{so15320248.edit(student)}"/>
        </p:tab>
    </p:accordionPanel>
</h:form>

マネージド Bean:

@ManagedBean(name = "so15320248")
@ViewScoped
public class SO15320248 implements Serializable {

    private static final long serialVersionUID = -2285963068688871710L;

    private List<Student> students;

    @PostConstruct
    public void init() {
        students = new ArrayList<Student>();
        students.add(new Student("Student 1"));
        students.add(new Student("Student 2"));
    }

    public void edit(Student student) {
        System.out.println("===========================");
        System.out.println(student.getName());
        System.out.println("===========================");
    }

    public List<Student> getStudents() {
        return students;
    }

    public void setStudents(List<Student> students) {
        this.students = students;
    }
}
于 2013-03-10T09:21:15.400 に答える