0
votes

I'm starting to use JSF with primefaces library over an Hibernate project. I've tried to use wizard component to manage a form but, when I click any of the buttons in the wizard, I get the following warning and the action listener is not invoked.

I think the problem is that, in the wizard there are some p:commandButton because when I use h:commandButton, everything works. Could someine explain in what way primefaces commandButton ih different from the standard one, and how could I face this problem? What's different in the rendering process?

Thanks for your help! Here's the warning:

9-ott-2012 9.50.43 org.apache.myfaces.trinidadinternal.context.PartialViewContextImpl getPartialResponseWriter
AVVERTENZA: getPartialResponseWriter() called during render_reponse. The returned writer is not integrated with PPRResponseWriter

Here's the code of the page:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">

<h:head>

<h:outputScript name="jsf.js" library="javax.faces" target="head" />
</h:head>

<h:body>



    <p:growl id="growl" showDetail="true" sticky="true" />

    <h:form>

    <p:wizard widgetVar="wiz"  
        flowListener="#{traduttoreBean.onFlowProcess}"> 

        <p:tab id="personali" title="Info Personali">  

        <p:panel header="Informazioni Personali">  

            <h:messages errorClass="error"/>  

            <h:panelGrid columns="2" columnClasses="label, value" styleClass="grid">  
                <h:outputText value="Nome: *" />  
                <p:inputText required="true" label="Nome"  
                        value="#{traduttoreBean.info.nome}" />  

                <h:outputText value="Cognome: *" />  
                <p:inputText required="true" label="cognome"  
                        value="#{traduttoreBean.info.cognome}" />

            </h:panelGrid>  

        </p:panel>  
    </p:tab>


    <p:tab id="confirm" title="Confirmation">  
        <p:panel header="Confirmation">  

            <h:panelGrid id="confirmation" columns="6">  
                <h:outputText value="Nome: " />  
                <h:outputText styleClass="outputLabel"  
                            value="#{traduttoreBean.info.nome}" />  

                <h:outputText value="Cognome: " />  
                <h:outputText  styleClass="outputLabel"  
                            value="#{traduttoreBean.info.cognome}" />  


                <h:outputText />  
            </h:panelGrid>  

           <p:commandButton value="Submit" update="growl" action="#{traduttoreBean.save}" ></p:commandButton> 

        </p:panel>  
    </p:tab>  

    </p:wizard> 
      </h:form> 

</h:body>
</html>

The associated bean:

public class TraduttoreBean implements Serializable{

/**
 * 
 */
private static final long serialVersionUID = 1L;


private Traduttore traduttore;
private InfoTraduttore info;

public TraduttoreBean(){

    this.traduttore=new Traduttore();
    this.info= new InfoTraduttore();
    this.info.setTraduttore(traduttore);

}

public void save(ActionEvent actionEvent) {  

    PersistenzaUtenti pu= PersistenzaUtenti.getInstance();
    PersistenzaInfoTraduttori pi= PersistenzaInfoTraduttori.getInstance();

    try {
        pu.insert(traduttore);
        pi.insert(info);
    } catch (Exception e) {

    }

    FacesMessage msg = new FacesMessage("Successful", "Welcome :" + info.getNome());  
    FacesContext.getCurrentInstance().addMessage(null, msg);  

}  


public String onFlowProcess(FlowEvent event) {  

        return event.getNewStep();  

} 



public Traduttore getTraduttore() {
    return traduttore;
}

public void setTraduttore(Traduttore traduttore) {
    this.traduttore = traduttore;
}

public InfoTraduttore getInfo() {
    return info;
}

public void setInfo(InfoTraduttore info) {
    this.info = info;
}

}

For the declaration of the bean I've tried both with the annotation @Managed bean and the faces-config file. Here's my definition:

<managed-bean>
    <managed-bean-name>traduttoreBean</managed-bean-name>
    <managed-bean-class>guiBeans.TraduttoreBean</managed-bean-class>
    <managed-bean-scope>view</managed-bean-scope>
</managed-bean>
1
try changing save(ActionEvent actionEvent) into save() , also you better use annotations instead of faces-configDaniel
or change action="#{traduttoreBean.save}" > into actionListener="#{traduttoreBean.save}" >roel
I tried all of this combination. The problem is that whit a standard h:commandButton, it works! Maybe I have not understood something about the Ajax behaviour of the p:commandButton. Either the flowListener="#{traduttoreBean.onFlowProcess}", that is called when Next button is pressed, doesn't work!Daniela Mogini
The problem was that Trinidad libraries were in conflict with Primefaces. Solved removing Trinidad libraries.Daniela Mogini

1 Answers

0
votes

Answer provided by comment:

The problem was that Trinidad libraries were in conflict with Primefaces. Solved removing Trinidad libraries.