JSF 2 ActionListener从未调用过

时间:2015-12-16 15:24:20

标签: java jsf jsf-2 primefaces liferay-6

我尝试调用一个简单的actionlistener,它使用JSF 2和primefaces从xhtml页面更新一个值。 永远不会调用动作侦听器,并且服务器日志(Tomcat)或任何地方都没有错误。 真正让我疯狂的事情是我过去成功地实现了这个,我仍然有代码,而且一切都是一样的!

这是.xhtml代码:

<?xml version="1.0"?>
<f:view xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head />
<h:body>



    <h:form id="form1">
       <h:inputText value="#{LessonDates.teacher_name}" />
        <p:commandButton value="Submit" actionListener="# {LessonDates.doIt}" />
    </h:form>
    <h:outputText value="#{LessonDates.teacher_name}" />
</h:body>

和javaBean:

@ManagedBean(name = "LessonDates" , eager = true)
@RequestScoped
public class LessonDatesBean implements Serializable {

public Date date;
public String teacher_AFM;
public String teacher_name = "Kritikos";
public boolean booked;

public List<LessonDates> lessonDatesList;
public List<Teacher> teacherList;

public LessonDatesBean(){

}


public void doIt(ActionEvent event) throws  SystemException {


    String buttonId = event.getComponent().getClientId();

    teacher_name = "Nikos";



}


public List<LessonDates> getLessonDatesList() {
    return lessonDatesList;
}

public void setLessonDatesList(List<LessonDates> lessonDatesList) {
    this.lessonDatesList = lessonDatesList;
}

public Date getDate() {
    return date;
}

public void setDate(Date date) {
    this.date = date;
}

public String getTeacher_AFM() {
    return teacher_AFM;
}

public void setTeacher_AFM(String teacher_AFM) {
    this.teacher_AFM = teacher_AFM;
}

public String getTeacher_name() {
    return teacher_name;
}

public void setTeacher_name(String teacher_name) {
    this.teacher_name = teacher_name;
}

public boolean isBooked() {
    return booked;
}

public void setBooked(boolean booked) {
    this.booked = booked;
}

非常感谢任何帮助。

0 个答案:

没有答案