JSF表单未提交

时间:2014-03-25 07:14:31

标签: spring jsf primefaces

请检查此表单提交的表单数据,但setAttendancedata方法正在运行.. 但是classname,sectionname,date没有在变量中设置..

XHTML:

 <p:panel header="Attendance Entry" style="margin-top:10px">
        <p:growl id="msgs" showDetail="true" />

        <h:form id="attendance">
            <h:panelGrid id="detail" columns="10" styleClass="grid"
                cellspacing="10" cellpadding="40">



                <h:outputText value="Date: " />
                <h:outputText value="" id="popupDate">
                    <f:convertDateTime pattern="yyyy-mm-dd" />
                </h:outputText>
                <p:calendar value="#{StudentAttendanceComponent.date}"
                    id="popupCal" />



                <h:outputText value="Class :" />

                <p:selectOneMenu id="classname"
                    value="#{StudentAttendanceComponent.classname}">
                    <f:selectItem itemLabel="Select Class Name" itemValue="" />
                    <f:selectItems value="#{PreferencesClassComponent.classnames}" />
                </p:selectOneMenu>


                <h:outputText value="Section :" />

                <p:selectOneMenu id="sectionname"
                    value="#{StudentAttendanceComponent.sectionname}">
                    <f:selectItem itemLabel="Select Section Name" itemValue="" />
                    <f:selectItems value="#{PreferencesSectionComponent.sectionnames}" />
                </p:selectOneMenu>



                <p:commandButton ajax="false" immediate="true" value="Go"
                    action="#{StudentAttendanceComponent.setAttendanceData}"
                    update="msgs" icon="ui-icon-check"></p:commandButton>

            </h:panelGrid>
        </h:form>

型号:

@Scope("session")
@Component("StudentAttendanceComponent")
public class StudentAttendanceComponentImpl implements
        StudentAttendanceComponent {

    /**
     * Data type variable that provides CRUD operations for StudentAttendance
     * entities
     * 
     */
    @Autowired
    StudentMasterService studentMasterService;

    private Date date = new Date();

    private String[] attData;

    private StudentAttendance studentattendance;

    private String classname;
    private String sectionname;


    private List<StudentAttendance> studentAttendances;


    @Autowired
    private StudentAttendanceDAO studentAttendanceDAO;

    /**
     * Service injected by Spring that provides CRUD operations for
     * StudentAttendance entities
     * 
     */
    @Autowired
    private StudentAttendanceService studentAttendanceService;


    public Date getDate() {
        return date;
    }

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





    public String getClassname() {
        return classname;
    }

    public void setClassname(String classname) {
        this.classname = classname;
    }

    public String getSectionname() {
        return sectionname;
    }

    public void setSectionname(String sectionname) {
        this.sectionname = sectionname;
    }


    public void setAttendanceData() {
        // TODO Auto-generated method stub
        System.out.println(classname+sectionname);
        FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO,
                "Filter Data", "Class " + classname + ", section " + sectionname+", date " + getDate().getDate());
        FacesContext.getCurrentInstance().addMessage("msgs", msg);

    }

1 个答案:

答案 0 :(得分:0)