I have Year Dropdown which is working fine.Now I want to add Month dropDown to fetch records but it is not working properly.
below is my code
<h:selectOneMenu value="#{eventMaster.yearFilter}"
onchange="submit()"
valueChangeListener="#{eventMaster.valueChangeListener}">
<f:selectItems value="#{eventMaster.yearDropDown}" />
</h:selectOneMenu>
<h:selectOneMenu value="#{eventMaster.monthFilter}"
onchange="submit()"
valueChangeListener="#{eventMaster.monthValueChangeListener}">
<f:selectItems value="#{eventMaster.monthDropDown}" />
</h:selectOneMenu>
------------------------------------------------------------
public void valueChangeListener(ValueChangeEvent event) {
Integer sessionFilterYear = (Integer) event.getNewValue();
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false);
if (sessionFilterYear != null) {
session.setAttribute("eventyearfilter", sessionFilterYear);
}
}
public void monthValueChangeListener(ValueChangeEvent event) {
Integer sessionFilterMonth = (Integer) event.getNewValue();
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false);
if (sessionFilterMonth != null) {
session.setAttribute("eventmonthfilter", sessionFilterMonth);
}
}
------------------------------------------------------------
public List<EventMasterBean> getEventMasterList() {
if ((this.inputSearch == null || this.inputSearch.equals("")) && this.searchVariableAvailable == false) {
this.eventMasterList = new ArrayList<EventMasterBean>();
EventMasterOps opsObj = new EventMasterOps();
if (this.yearFilter == 0 ) {
System.out.println("IN EventMaster getEventMasterList()::1: "+this.yearFilter);
defaultSetYearFilter();
}
opsObj.init(Integer.toString(this.yearFilter));
this.eventMasterList = opsObj.getEventmaster();
} else if (this.inputSearch != null && this.searchVariableAvailable == false) {
searchInputScreenRecords();
}
return this.eventMasterList;
}