Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

How to Add Another Filter in Jsf

  Asked By: Asim    Date: Sep 25    Category: Java    Views: 503
  

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;
}

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on How to Add Another Filter in Jsf Or get search suggestion and latest updates.




Tagged: