Sorry my mistake, I'm actually using valueChangeListener.
Here are the bits of code that are not working like expected:
the page TestistBox.jsp:
]<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<!-- - -->
<!--INIT OBJECTS-- -->
<!-- - -->
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
// Adapt URL to page name
String url = request.getRequestURL().toString();
url = url.replace("jsp","faces");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<f:view>
<head>
</head>
<body>
<h:form id="Monitoring">
<h:selectOneMenu id="modulefilter" value="#{TototBean.moduleId}" valueChangeListener="#{TototBean.moduleSelection}" onchange="submit();" immediate="true" rendered="true">
<f:selectItems value="#{TototBean.moduleList}" />
</h:selectOneMenu>
<h:selectOneMenu id="servicefilter" value="#{TototBean.serviceId}" valueChangeListener="#{TototBean.serviceSelection}" onchange="submit();" immediate="true" rendered="true">
<f:selectItems value="#{TototBean.serviceList}" />
</h:selectOneMenu>
<h:selectOneMenu id="actionfilter" value="#{TototBean.actionId}" valueChangeListener="#{TototBean.actionSelection}" onchange="submit();" immediate="true" rendered="true">
<f:selectItems value="#{TototBean.actionList}" />
</h:selectOneMenu>
</h:form>
</body>
</f:view>
</html>
the managed bean : TototBean.java
/**
*
*/
package com.toto.monitoring.bean;
import java.util.ArrayList;
import java.util.List;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
public final class TototBean extends Object {
private ArrayList<SelectItem> moduleList;
private ArrayList<SelectItem> serviceList;
private ArrayList<SelectItem> actionList;
private StringmoduleId;
private StringserviceId;
private StringactionId;
public TototBean() {
super();
// TODO Auto-generated constructor stub
this.moduleList = new ArrayList<SelectItem>();
this.serviceList = new ArrayList<SelectItem>();
this.actionList = new ArrayList<SelectItem>();
initModuleList();
initServiceList();
initActionList();
}
final List initModuleList() {
System.out.println("init module list");
moduleList = new ArrayList<SelectItem>();
moduleList.add(new SelectItem("All Modules", "All Modules"));
moduleList.add(new SelectItem("Module 1", "Module 1"));
moduleList.add(new SelectItem("Module 2", "Module 2"));
return moduleList;
}
public List getModuleList() {
System.out.println("get module list");
return moduleList;
}
public String getModuleId() {
System.out.println("get module ID");
return moduleId;
}
public void setModuleId(String id) {
System.out.println("set module ID");
moduleId = id;
}
public void moduleSelection(ValueChangeEvent e) {
System.out.println("module dselection");
FacesContext context = FacesContext.getCurrentInstance();
moduleId =(String) e.getNewValue();
this.actionId = "All Actions";
this.serviceId = "All Services";
context.renderResponse();
}
final List initServiceList() {
System.out.println("init service list");
serviceList = new ArrayList<SelectItem>();
serviceList.add(new SelectItem("All Services", "All Services"));
serviceList.add(new SelectItem("Service 1", "Service 1"));
serviceList.add(new SelectItem("Service 2", "Service 2"));
return serviceList;
}
public List getServiceList() {
System.out.println("get service list");
return serviceList;
}
public String getServiceId() {
System.out.println("get service ID");
return serviceId;
}
public void setServiceId(String id) {
System.out.println("set service ID");
serviceId = id;
}
public void serviceSelection(ValueChangeEvent e) {
System.out.println("service selection");
FacesContext context = FacesContext.getCurrentInstance();
serviceId =(String) e.getNewValue();
this.actionId = "All Actions";
this.moduleId = "All Modules";
context.renderResponse();
}
final List initActionList() {
actionList = new ArrayList<SelectItem>();
actionList.add(new SelectItem("All Actions", "All Actions"));
actionList.add(new SelectItem("Actions 1", "Action 1"));
actionList.add(new SelectItem("Actions 2", "Action 2"));
return actionList;
}
public List getActionList() {
return actionList;
}
public String getActionId() {
return actionId;
}
public void setActionId(String id) {
actionId = id;
}
public void actionSelection(ValueChangeEvent e) {
FacesContext context = FacesContext.getCurrentInstance();
actionId =(String) e.getNewValue();
this.moduleId = "All Modules";
this.serviceId = "All Services";
context.renderResponse();
}
}
and the configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config >
<managed-bean>
<managed-bean-name>TototBean</managed-bean-name>
<managed-bean-class>com.clearstream.monitoring.bean.TototBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>moduleId</property-name>
<property-class>java.lang.String</property-class>
<value>"All Modules"</value>
</managed-property>
<managed-property>
<property-name>actionId</property-name>
<property-class>java.lang.String</property-class>
<value>"All Actions"</value>
</managed-property>
<managed-property>
<property-name>serviceId</property-name>
<property-class>java.lang.String</property-class>
<value>"All Services"</value>
</managed-property>
</managed-bean>
</faces-config>
This seems so basic, three listboxes and that's it.