Я пытаюсь использовать меню для управления некоторой выходной панелью (с Бином), в которую я помещаю другую форму (я пробовал без нее, но она не работает) с некоторым selectOneMenu и некоторым inputText. И вот, я управляю этими вещами с другим Бином.
ManageApplication.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:form>
<p:menubar id="menu" autoSubmenuDisplay="true">
<p:menuitem value="Acceuil"
actionListener="#{applicationWizard.showHomePanel}"
icon="ui-icon-home" update="@form" />
<p:submenu label="Séléction" icon="ui-icon-gear">
<p:menuitem value="Séléctionner"
actionListener="#{applicationWizard.showSelectionPanel}"
update="@form" />
<p:menuitem value="Créer"
actionListener="#{applicationWizard.showCreationPanel}"
update="@form" />
</p:submenu>
</p:menubar>
<p></p>
<p:panel>
<p:outputPanel widgetVar="homePanel"
rendered="#{applicationWizard.viewHomePanel}" autoUpdate="true">
l33t
</p:outputPanel>
<p:outputPanel widgetVar="creationPanel"
rendered="#{applicationWizard.viewCreationPanel}" autoUpdate="true">
<h:form>
<h:panelGrid columns="2">
<h:outputText value="Référence :" />
<p:inputText value="#{createApplicationBean.reference}"
style="width:300px;" />
<h:outputText value="Client :" />
<p:selectOneMenu value="#{createApplicationBean.customer}"
converter="customerConverter" style="width:300px;">
<f:selectItem itemValue="" itemLabel="Selectionner" />
<f:selectItems value="#{createApplicationBean.customers}"
var="customer" itemLabel="#{customer.displayed}"
itemValue="#{customer}" />
</p:selectOneMenu>
<h:outputText value="Type d'application :" />
<p:selectOneMenu value="#{createApplicationBean.applicationType}"
converter="applicationTypeConverter" style="width:300px;">
<f:selectItem itemValue="" itemLabel="Selectionner" />
<f:selectItems value="#{createApplicationBean.applicationTypes}"
var="applicationType" itemLabel="#{applicationType.displayed}"
itemValue="#{applicationType}" />
</p:selectOneMenu>
<h:outputText value="Famille d'application :" />
<p:selectOneMenu
value="#{createApplicationBean.applicationFamily}"
converter="applicationFamilyConverter" style="width:300px;">
<f:selectItem itemValue="" itemLabel="Selectionner" />
<f:selectItems
value="#{createApplicationBean.applicationFamilies}"
var="applicationFamily"
itemLabel="#{applicationFamily.displayed}"
itemValue="#{applicationFamily}" />
</p:selectOneMenu>
<h:outputText value="Pression :" />
<p:selectOneMenu value="#{createApplicationBean.pressure}"
converter="pressureConverter" style="width:300px;">
<f:selectItem itemValue="" itemLabel="Selectionner" />
<f:selectItems value="#{createApplicationBean.pressures}"
var="pressure" itemLabel="#{pressure.displayed}"
itemValue="#{pressure}" />
</p:selectOneMenu>
<h:outputText value="Fluide :" />
<p:selectOneMenu value="#{createApplicationBean.fluid}"
converter="fluidConverter" style="width:300px;">
<f:selectItem itemValue="" itemLabel="Selectionner" />
<f:selectItems value="#{createApplicationBean.fluids}"
var="fluid" itemLabel="#{fluid.displayed}" itemValue="#{fluid}" />
</p:selectOneMenu>
<h:outputText value="Cylindrée :" />
<p:selectOneMenu value="#{createApplicationBean.cylinder}"
converter="cylinderConverter" style="width:300px;">
<f:selectItem itemValue="" itemLabel="Selectionner" />
<f:selectItems value="#{createApplicationBean.cylinders}"
var="cylinder" itemLabel="#{cylinder.displayed}"
itemValue="#{cylinder}" />
</p:selectOneMenu>
<h:outputText value="Fonctionnement :" />
<p:selectOneMenu value="#{createApplicationBean.working}"
converter="workingConverter" style="width:300px;">
<f:selectItem itemValue="" itemLabel="Selectionner" />
<f:selectItems value="#{createApplicationBean.workings}"
var="working" itemLabel="#{working.displayed}"
itemValue="#{working}" />
</p:selectOneMenu>
<h:outputText value="Condensateur permanent :" />
<p:inputText value="#{createApplicationBean.permanentCapacitor}"
style="width:300px;" />
<h:outputText value="Condensateur de démarrage mini :" />
<p:inputText value="#{createApplicationBean.miniCapacitorStart}"
style="width:300px;" />
<h:outputText value="Condensateur de démarrage maxi :" />
<p:inputText id="createApplicationMaxiCapacitorStart"
value="#{createApplicationBean.maxiCapacitorStart}"
style="width:300px;" />
<p:commandButton value="Créer" icon="ui-icon-check"
actionListener="#{createApplicationBean.create}" />
</h:panelGrid>
</h:form>
</p:outputPanel>
<p:outputPanel widgetVar="selectionPanel"
rendered="#{applicationWizard.viewSelectionPanel}" autoUpdate="true">
w00t w00t
</p:outputPanel>
</p:panel>
</h:form>
</ui:composition>
CreateApplicationBean.java
package org.bean;
import java.util.List;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
import org.config.Tracer;
import org.objects.ApplicationFamily;
import org.objects.ApplicationType;
import org.objects.Customer;
import org.objects.Cylinder;
import org.objects.Fluid;
import org.objects.Pressure;
import org.objects.Ventilation;
import org.objects.Working;
@ManagedBean ( name = "createApplicationBean" )
public class CreateApplicationBean implements ActionListener {
private String reference;
private Customer customer;
private ApplicationType applicationType;
private ApplicationFamily applicationFamily;
private Pressure pressure;
private Fluid fluid;
private Cylinder cylinder;
private Ventilation ventilation;
private Working working;
private float permanentCapacitor;
private float miniCapacitorStart;
private float maxiCapacitorStart;
public Working getWorking () {
return working;
}
public void setWorking ( Working working ) {
System.out.println("CreateApplicationBean.setWorking");
this.working = working;
}
public Cylinder getCylinder () {
return cylinder;
}
public void setCylinder ( Cylinder cylinder ) {
System.out.println("CreateApplicationBean.setCylinder");
this.cylinder = cylinder;
}
public List<Cylinder> getCylinders () {
return Cylinder.getAll();
}
public Fluid getFluid () {
return fluid;
}
public void setFluid ( Fluid fluid ) {
System.out.println("CreateApplicationBean.setFluid");
this.fluid = fluid;
}
public List<Fluid> getFluids () {
return Fluid.getAll();
}
public Pressure getPressure () {
return pressure;
}
public void setPressure ( Pressure pressure ) {
System.out.println("CreateApplicationBean.setPressure");
this.pressure = pressure;
}
public List<Pressure> getPressures () {
return Pressure.getAll();
}
public ApplicationFamily getApplicationFamily () {
return applicationFamily;
}
public void setApplicationFamily ( ApplicationFamily applicationFamily ) {
System.out.println("CreateApplicationBean.setApplicationFamily");
this.applicationFamily = applicationFamily;
}
public List<Ventilation> getVentilations () {
return Ventilation.getAll();
}
public List<ApplicationFamily> getApplicationFamilies () {
return ApplicationFamily.getAll();
}
public List<ApplicationType> getApplicationTypes () {
return ApplicationType.getAll();
}
public List<Customer> getCustomers () {
return Customer.getAll();
}
public List<Working> getWorkings () {
return Working.getAll();
}
public String getReference () {
return reference;
}
public void setReference ( String reference ) {
System.out.println("CreateApplicationBean.setReference");
this.reference = reference;
}
public Customer getCustomer () {
return customer;
}
public void setCustomer ( Customer customer ) {
System.out.println("CreateApplicationBean.setCurstomer");
this.customer = customer;
}
public ApplicationType getApplicationType () {
return applicationType;
}
public void setApplicationType ( ApplicationType applicationType ) {
System.out.println("CreateApplicationBean.setApplicationType");
this.applicationType = applicationType;
}
public Ventilation getVentilation () {
return ventilation;
}
public void setVentilation ( Ventilation ventilation ) {
System.out.println("CreateApplicationBean.setVentilation");
this.ventilation = ventilation;
}
public float getPermanentCapacitor () {
return permanentCapacitor;
}
public void setPermanentCapacitor ( float permanentCapacitor ) {
System.out.println("CreateApplicationBean.setPermanentCapacitor");
Tracer.println("CreateApplicationBean.create");
this.permanentCapacitor = permanentCapacitor;
}
public float getMiniCapacitorStart () {
return miniCapacitorStart;
}
public void setMiniCapacitorStart ( float miniCapacitorStart ) {
Tracer.println("CreateApplicationBean.create");
this.miniCapacitorStart = miniCapacitorStart;
}
public float getMaxiCapacitorStart () {
return maxiCapacitorStart;
}
public void setMaxiCapacitorStart ( float maxiCapacitorStart ) {
Tracer.println("CreateApplicationBean.create");
this.maxiCapacitorStart = maxiCapacitorStart;
}
public void create ( ActionEvent actionEvent ) {
Tracer.println("CreateApplicationBean.create");
System.out.println("CreateApplicationBean.create");
FacesMessage msg = null;
msg = new FacesMessage(FacesMessage.SEVERITY_FATAL,
"Erreur lors de la création.", "");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
@Override
public void processAction ( ActionEvent event )
throws AbortProcessingException {
Tracer.println("CreateApplicationBean.processAction");
}
}
ApplicationWizard.java
package org.wizard;
import java.awt.event.ActionEvent;
import javax.faces.bean.ManagedBean;
import org.objects.Application;
@ManagedBean
public class ApplicationWizard {
private Application selectionnedApplication ;
private boolean viewHomePanel = true;
private boolean viewCreationPanel = false;
private boolean viewSelectionPanel = false;
public Application getSelectionnedApplication() {
return selectionnedApplication;
}
public void setSelectionnedApplication(Application selectionnedApplication) {
this.selectionnedApplication = selectionnedApplication;
}
public void showHomePanel ( ActionEvent evt ) {
showHomePanel ();
}
public void showHomePanel () {
this.viewHomePanel = true ;
this.viewCreationPanel = false ;
this.viewSelectionPanel = false ;
}
public boolean isViewHomePanel() {
return viewHomePanel;
}
public void setViewHomePanel(boolean viewHomePanel) {
this.viewHomePanel = viewHomePanel;
}
public void showCreationPanel ( ActionEvent evt ) {
showCreationPanel ();
}
public void showCreationPanel () {
this.viewHomePanel = false ;
this.viewCreationPanel = true ;
this.viewSelectionPanel = false ;
}
public boolean isViewCreationPanel() {
return viewCreationPanel;
}
public void setViewCreationPanel(boolean viewCreationPanel) {
this.viewCreationPanel = viewCreationPanel;
}
public void showSelectionPanel ( ActionEvent evt ) {
showSelectionPanel ();
}
public void showSelectionPanel () {
this.viewHomePanel = false ;
this.viewCreationPanel = false ;
this.viewSelectionPanel = true ;
}
public boolean isViewSelectionPanel() {
return viewSelectionPanel;
}
public void setViewSelectionPanel(boolean viewSelectionPanel) {
this.viewSelectionPanel = viewSelectionPanel;
}
}
Я пытался использовать один Боб без другого, и они работают ... Но когда я объединяю их ... они не делают.