Hi I wanna ask something, I try to make a form for website using java with primeface, I make this form with 2 page but when I try to input data, the data from second page can't set on database sometimes when I try to modify the code the data on first page can't set but the data on second page can be set on database
this my code for save data
public String save(){
String nextPage = "";
PRPKUserNonIt PRPKUser = new PRPKUserNonIt();
PRPKUser prpkUser = new PRPKUser();
setListUserSelected(chooseBean.getListSelecteduser());
try{
prpkUserController.save(prpkUser);
nextPage = "/prpk/master_prpk.xhtml?faces-redirect=true";
RequestContext rq = RequestContext.getCurrentInstance();
rq.execute("PF('successDialog').show();");
}catch(Exception e){
e.printStackTrace();
FacesMessage messageFailed = new FacesMessage(FacesMessage.SEVERITY_ERROR,"Error","Save data failed");
RequestContext.getCurrentInstance().showMessageInDialog(messageFailed);
nextPage = "#";
}
Group group = new Group();
setListGroupSelected(chooseTargetSDDialogBean.getGroupSelection());
try{
groupController.save(group);
nextPage = "/prpk/master_prpk.xhtml?faces-redirect=true";
RequestContext rq = RequestContext.getCurrentInstance();
rq.execute("PF('successDialog').show();");
}catch(Exception e){
e.printStackTrace();
FacesMessage messageFailed = new FacesMessage(FacesMessage.SEVERITY_ERROR,"Error","Save data failed");
RequestContext.getCurrentInstance().showMessageInDialog(messageFailed);
nextPage = "#";
}
PRPKNon PRPKNon = new PRPKNon();
PRPKNon.setUser_non_itId(userLogin.getId());
PRPKNon.setSenderId(userLogin.getId());
PRPKNon.setPic_prpkId(userLogin.getId());
PRPKNon.setCreatedBy(userLogin.getName());
PRPKNon.setUpdatedBy(userLogin.getName());
for (Map.Entry<String, Integer> e : prpkTypeIdMap.entrySet()) {
if (prpkTypeTypeId.equals(e.getValue())) {
prpkTypeType = e.getKey();
continue;
}
}
PRPKNon.setPrpkTypeId(prpkTypeTypeId); //diubah
PRPKNon.setPrpkTypeName(prpkTypeType);
PRPKNon.setPrpkDesc(prpkDesc);
PRPKNon.setMemoNumber(memoNumber);
for (Map.Entry<String, Integer> e : priorityIdMap.entrySet()) {
if (priorityTypeId.equals(e.getValue())) {
priorityType = e.getKey();
continue;
}
}
setPriorityLevelId(priorityTypeId);
setPriorityName(priorityType);
for (Map.Entry<String, Integer> e : departmentIdMap.entrySet()) {
if (departmentTypeId.equals(e.getValue())) {
departmentType = e.getKey();
continue;
}
}
for (Map.Entry<String, Integer> e : businessUnitIdMap.entrySet()) {
if (businessUnitTypeId.equals(e.getValue())) {
businessUnitType = e.getKey();
continue;
}
}
PRPKNon.setPriorityId(getPriorityLevelId());//diubah
PRPKNon.setPriorityLevel(getPriorityName());
PRPKNon.setBusinessUnitId(getBusinessId());
PRPKNon.setBusinessUnitName(getBussinessName());
PRPKNon.setPicDepartmentId(getDepartmentId());
PRPKNon.setDepartmentName(getDepartmentNames());
PRPKNon.setBusinessUnitId(getBusinessUnitId());
PRPKNon.setPicDepartmentId(departmentTypeId);//diubah
System.out.println("Pic : "+ prpk.getPicDepartmentId());
PRPKNon.setDepartmentName(departmentType);
PRPKNon.setBusinessUnitId(businessUnitTypeId);//diubah
PRPKNon.setBusinessUnitName(businessUnitType);
nextPage = "/prpk/next_prpk_new.xhtml?faces-redirect=true";
PRPKNon.setPrpkRequest(prpkRequest);
PRPKNon.setPrpkBackground(prpkBackground);
PRPKNon.setPrpk_analysisBenefit(prpk_analysisBenefit);
try{
prpkNonController.save(PRPKNon);
nextPage = "/prpk/next_prpk_new.xhtml?faces-redirect=true";
RequestContext rq = RequestContext.getCurrentInstance();
rq.execute("PF('successDialog').show();");
}catch(Exception e){
e.printStackTrace();
FacesMessage messageFailed = new FacesMessage(FacesMessage.SEVERITY_ERROR,"Error","Save data failed");
RequestContext.getCurrentInstance().showMessageInDialog(messageFailed);
nextPage = "#";
}
return nextPage;
}
this xhtml for the first page
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
template="/user_templates/template.xhtml">
<ui:define name="metadata">
</ui:define>
<ui:define name="content">
<h:form id="formId" style="margin-top:35;" prependId="false">
<p:contextMenu>
<p:menuitem value="© Indomaret" />
</p:contextMenu>
<p:breadCrumb>
<p:menuitem value="Home" />
<p:menuitem value="PRPK" />
<p:menuitem value="List PRPK"/>
<p:menuitem value="Add New PRPK"/>
<p:menuitem value="#{pRPKUserNonItBean.header}" />
</p:breadCrumb>
<h:panelGrid id="TableInputId" columns="2" cellpadding="10" >
<h:panelGrid id="inputGridId1" columns="3" cellpadding="10" >
<p:outputLabel value="PRPK Type" for="prpktypeTxt" />
<p:selectOneMenu id="prpktypeTxt" value="#{pRPKUserNonItBean.prpkTypeTypeId}"
>
<p:ajax listener="#{pRPKUserNonItBean.updateButton}" update="formId"/>
<f:selectItem itemLabel="None Selected" itemValue=""
noSelectionOption="true" />
<f:selectItems value="#{pRPKUserNonItBean.prpkTypeIdMap}" />
</p:selectOneMenu>
<p:message for="prpktypeTxt" display="icon" />
<p:outputLabel value="PRPK Reference" for="prpkReferenceTxt" />
<h:panelGrid columns="2" cellpadding="0" border="0">
<p:inputText id="prpkReferenceTxt" disabled="true"
readonly="true" style="width:200; height:25"
value="#{pRPKUserNonItBean.prpkReference}" />
<p:commandButton icon="ui-icon-search"
action="#{pRPKUserNonItBean.showPRPKReferenceDialog}" rendered="#{pRPKUserNonItBean.prpkReferenceRendered}" process="#this">
<p:ajax event="dialogReturn" update="prpkReferenceTxt" />
</p:commandButton>
</h:panelGrid>
<p:message for="prpkReferenceTxt" display="icon"></p:message>
<p:outputLabel value="Description" for="descriptionTxt" />
<p:inputTextarea id="descriptionTxt" required="true" style="width:300; height:50"
value="#{pRPKUserNonItBean.prpkDesc}" />
<p:message for="descriptionTxt" display="icon"></p:message>
<p:outputLabel value="Memo" for="memoTxt"
style="display:block; width:100px;" />
<p:inputText id="memoTxt" required="true" style="width:225; height:25"
value="#{pRPKUserNonItBean.memoNumber}" />
<p:message for="memoTxt" display="icon"></p:message>
</h:panelGrid>
<h:panelGrid id="inputGridId2" columns="3" cellpadding="10" >
<p:outputLabel value="Priority Level" for="prioritylevelTxt" />
<p:selectOneMenu id="prioritylevelTxt" value="#{pRPKUserNonItBean.priorityTypeId}"
>
<f:selectItem itemLabel="None Selected" itemValue=""
noSelectionOption="true" />
<f:selectItems value="#{pRPKUserNonItBean.priorityIdMap}" />
</p:selectOneMenu>
<p:message for="prioritylevelTxt" display="icon" />
<p:outputLabel value="Department" for="departmentTxt" />
<p:selectOneMenu id="departmentTxt" value="#{pRPKUserNonItBean.departmentTypeId}"
>
<f:selectItem itemLabel="None Selected" itemValue=""
noSelectionOption="true" />
<f:selectItems value="#{pRPKUserNonItBean.departmentIdMap}" />
</p:selectOneMenu>
<p:message for="departmentTxt" display="icon" />
<p:outputLabel value="OPU" for="opuTxt" />
<p:selectOneMenu id="opuTxt" value="#{pRPKUserNonItBean.businessUnitTypeId}"
>
<f:selectItem itemLabel="None Selected" itemValue=""
noSelectionOption="true" />
<f:selectItems value="#{pRPKUserNonItBean.businessUnitIdMap}" />
</p:selectOneMenu>
<p:message for="opuTxt" display="icon" />
<p:row></p:row><p:row></p:row><p:row></p:row>
<p:row></p:row><p:row></p:row><p:row></p:row>
<p:row></p:row><p:row></p:row><p:row></p:row>
<p:row></p:row><p:row></p:row><p:row></p:row>
<p:row></p:row><p:row></p:row><p:row></p:row>
</h:panelGrid>
</h:panelGrid>
<p:outputLabel value="Target SD *" style="border:0;margin-top:10;margin-left:25;"/>
<h:panelGrid width="60%">
<p:commandButton value="Select Target SD"
action="#{pRPKUserNonItBean.showTargetSDDialog()}" immediate="true" >
<p:ajax event="dialogReturn" update="targetTable"/>
</p:commandButton>
<p:dataTable
paginatorPosition="bottom" rows="3" paginator="true"
rowsPerPageTemplate="10,15,25,50,100" rowIndexVar="rowIndex"
currentPageReportTemplate="Showing {startRecord}-{endRecord} out of {totalRecords}"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
style="font-size:12px;"
var="group" widgetVar="targetTables" value="#{chooseTargetSDDialogBean.listGroupTemp}" id="targetTable">
<p:column headerText="No" width="5%">
<h:outputText value="#{rowIndex+1}" />
</p:column>
<p:column headerText="Target SD" width="40%">
<h:outputText value="#{group.name}" />
</p:column>
<p:column headerText="Description" width="45%">
<h:outputText value="#{group.description}" />
</p:column>
<p:column headerText="Delete" width="10%">
<center>
<p:commandButton icon="ui-icon-trash" action="#{chooseTargetSDDialogBean.deleteChooseGroupTargetSD(group)}" update="targetTable" immediate="true"/>
</center>
</p:column>
</p:dataTable>
</h:panelGrid>
<p:commandButton value="Cancel"
style="position: relative; bottom: -15px;" icon="ui-icon-circle-close"
process="#this" action="/prpk/master_prpk.xhtml?faces-redirect=true" />
<p:commandButton value="Next"
style="float:right; position: relative; bottom: -15px;" icon="ui-icon-arrow-1-e"
action="#{PRPKUserNonItBean.save}" process="#this">
<!-- <p:confirm header="Confirmation"
message="Are you sure the data correct ?" icon="ui-icon-alert" /> -->
</p:commandButton>
</h:form>
</ui:define>
and this xhtml for the second page
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
template="/user_templates/template.xhtml">
<ui:define name="metadata">
</ui:define>
<ui:define name="content">
<h:form id="formId" style="margin-top:35;">
<p:contextMenu>
<p:menuitem value="© Indomaret" />
</p:contextMenu>
<p:breadCrumb>
<p:menuitem value="PRPK" />
<p:menuitem value="PRPK" />
<p:menuitem value="List PRPK" />
<p:menuitem value="Add New PRPK"
url="/prpk/prpk_new.xhtml?faces-redirect=true" />
<p:menuitem value="#{pRPKUserNonItBean.header}" />
</p:breadCrumb>
<h:panelGrid style="margin-left:5;margin-top:20;">
<h2>PIC PRPK *</h2>
</h:panelGrid>
<h:panelGrid style="margin-left:0;margin-bottom:20;margin-top:5;">
<p:commandButton value="Select PIC PRPK" icon="ui-icon-circle-plus"
action="#{pRPKUserNonItBean.showPicPRPKDialog}" immediate="true">
<p:ajax event="dialogReturn" update="roleTbl" />
</p:commandButton>
<p:dataTable var="prpk" id="roleTbl"
value="#{chooseNonITUserDialogBean.listUserTemp}">
<p:column headerText="Name">
<h:outputText value="#{prpk.name}" />
</p:column>
<p:column headerText="Department">
<h:outputText value="#{prpk.departmentName}" />
</p:column>
<p:column headerText="Head user">
<h:outputText value="#{prpk.headUserName}" />
</p:column>
<p:column headerText="Delete" width="10%">
<center>
<p:commandButton icon="ui-icon-trash"
action="#{chooseNonITUserDialogBean.deleteUser(prpk)}"
update="roleTbl"
immediate="true" />
</center>
</p:column>
</p:dataTable>
</h:panelGrid>
<h:panelGrid columns="3" cellpadding="5" style="margin-left:10;">
<p:outputLabel value="Request" for="requestTxt"
style="display:block; width:100px;" />
<p:inputTextarea id="requestTxt" required="true"
style="width:700; height:25" value="#{pRPKUserNonItBean.prpkRequest}" />
<p:message for="requestTxt" display="icon"></p:message>
<p:outputLabel value="Background" for="backgroundTxt" />
<p:inputTextarea id="backgroundTxt" style="width:700; height:25"
value="#{pRPKUserNonItBean.prpkBackground}" />
<p:message for="backgroundTxt" display="icon"></p:message>
<p:outputLabel value="Benefit Analysis" for="beNalTxt" />
<p:inputTextarea id="beNalTxt" style="width:700; height:25"
value="#{pRPKUserNonItBean.prpk_analysisBenefit}" />
<p:message for="beNalTxt" display="icon"></p:message>
</h:panelGrid>
<h:panelGrid columns="2" style="margin-left:120;">
<p:commandButton value="Back"
style="height:25; font-weight:bold; margin-left:5;"
icon="ui-icon-circle-close" process="#this"
action="/prpk/prpk_new.xhtml?faces-redirect=true" />
<p:commandButton id="submitBtn" value="#{pRPKUserNonItBean.buttonName}"
style=" font-weight:bold;margin-left:10;"
type="submit" icon="ui-icon-disk" action="#{pRPKUserNonItBean.saveEdit}"
update="formId" />
<p:defaultCommand target="submitBtn" />
</h:panelGrid>
<p:dialog modal="false" widgetVar="successDialog" header="Info"
closable="false">
<h:panelGrid columns="1" cellpadding="2">
<h:outputText value="Save data berhasil" />
<center>
<p:commandButton value="Ok"
action="/prpk/master_prpk.xhtml?faces-redirect=true"
onclick="PF('successDialog').hide()" />
</center>
</h:panelGrid>
</p:dialog>
<p:dialog modal="false" widgetVar="failedDialog" header="Info"
closable="false">
<h:panelGrid columns="1" cellpadding="2">
<h:outputText value="Save data failed" />
<center>
<p:commandButton value="Ok" action="#"
onclick="PF('failedDialog').hide()" />
</center>
</h:panelGrid>
</p:dialog>
</h:form>
</ui:define>
Related
I'm working on primefaces and i can't understand this error.
My all xhtml code
My xhtml code :
<ui:composition template="/layout/template.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
>
<ui:define name="content">
<h:form id="formTab">
<p:commandButton value="Ajouter" oncomplete="PF('addNewDialog').show()" />
<p:dataTable var="tasktype" value="#{taskTypeBean.allTaskTypes}" id="taskType" selection="#{taskTypeBean.selectedTaskType}" selectionMode="single" rowKey="#{tasktype.reference}">
<p:column headerText="Reference">
<h:outputText value="#{tasktype.reference}" />
</p:column>
<p:column headerText="Description">
<h:outputText value="#{tasktype.description}" />
</p:column>
<p:column headerText="Prix Hors Taxe">
<h:outputText value="#{tasktype.htPrice}" />
</p:column>
</p:dataTable>
<p:contextMenu for="taskType">
<p:menuitem value="Modifier" action="#{taskTypeBean.updateDialog()}" update=":updateForm:udpatePanel" />
<p:menuitem value="Supprimer" action="#{taskTypeBean.deleteTaslType()}" update="taskType" />
</p:contextMenu>
</h:form>
<p:dialog widgetVar="updateDialog" modal="true" appendTo="#(body)">
<h:form id="updateForm">
<p:growl id="growlModif" showDetail="true" sticky="true" />
<p:panelGrid columns="2" id="udpatePanel">
<p:outputLabel for="reference" value="Reference :"/>
<p:inputText id="reference" required="true" requiredMessage="Entrez une reference" disabled="true" value="#{taskTypeBean.taskToUpdate.reference}"/>
<p:outputLabel for="description" value="Description :"/>
<p:inputText id="description" required="true" requiredMessage="Entrez une description" value="#{taskTypeBean.taskToUpdate.description}"/>
<p:outputLabel for="HTprice" value="HTprice :"/>
<p:inputText id="HTprice" required="true" requiredMessage="Entrez un prix hors taxe" value="#{taskTypeBean.taskToUpdate.htPrice}"/>
<p:commandButton value="Modifier" id="modifier" action="#{taskTypeBean.updateTaskType}" update=":formTab:taskType" oncomplete="PF('updateDialog').hide()" styleClass="ui-priority-primary" />
</p:panelGrid>
</h:form>
</p:dialog>
<p:dialog widgetVar="addNewDialog" modal="true" appendTo="#(body)">
<h:form>
<p:growl id="growlAdd" showDetail="true" sticky="true" />
<p:panelGrid columns="2">
<p:outputLabel for="reference" value="Reference :"/>
<p:inputText id="reference" required="true" requiredMessage="Entrez une reference" value="#{taskTypeBean.newReference}"/>
<p:outputLabel for="description" value="Description :"/>
<p:inputText id="description" required="true" requiredMessage="Entrez une description" value="#{taskTypeBean.newDescription}"/>
<p:outputLabel for="HTprice" value="HTprice :"/>
<p:inputText id="HTprice" required="true" requiredMessage="Entrez un prix hors taxe" value="#{taskTypeBean.newHTprice}"/>
<p:commandButton value="Ajouter" id="ajouter" action="#{taskTypeBean.addNewTaskType}" update=":formTab:taskType" oncomplete="PF('addNewDialog').hide()" styleClass="ui-priority-primary" />
</p:panelGrid>
</h:form>
</p:dialog>
</ui:define>
There is 3 differents form in this page
So, we can see and i have this issue :
javax.servlet.ServletException: MenuItem must be inside a form element
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
I built this page with an template very basic, i can't understand this problem.
Thanks for your help
I implement a <h:form> to edit Employee data which gets preloaded from the database. The preload works fine - all fields get filled with data. The <h:form id="editEmployeeForm"> is surrounded by a <h:form> which contains a <p:dataTable>.
When I do an edit on Employee data and click the "Speichern"-button nothing happens. <p:messages> says all my fields are empty what is obviously a wrong validation because all fields are prefilled. Then I deleted all <p:message> tags from my <h:inputText> tags to check whether the doSaveEmployeeEdit() gets called at all. But nothing happens - no error in console, etc. Even a simple System.out.println() doesn't get printed from the doSaveEmployeeEdit() at all.
Below the <p:dialog> what I have at the time:
<h:form id="editEmployeeForm">
<p:dialog header="Angestellten ändern" id="employeeEditDialog" widgetVar="employeeEditDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false" closeOnEscape="true">
<p:outputPanel id="employeeDataEdit" rendered="#{not empty employeeEditController.employee}">
<h:panelGrid columns="2">
<p:outputLabel for="usernameEdit" value="Benutzername: " />
<p:inputText id="usernameEdit" value="#{employeeEditController.employee.username}" disabled="true" />
</h:panelGrid>
<p:separator/>
<h:panelGrid columns="6">
<p:outputLabel for="firstnameEdit" value="Vorname: " />
<p:inputText id="firstnameEdit" value="#{employeeEditController.employee.firstName}" />
<p:outputLabel for="lastnameEdit" value="Nachname: " />
<p:inputText id="lastnameEdit" value="#{employeeEditController.employee.lastName}" />
<p:outputLabel for="birthdayEdit" value="Geburtsdatum: " />
<p:inputMask mask="99/99/9999" id="birthdayEdit" value="#{employeeEditController.employee.birthday}" />
<p:outputLabel for="locationEdit" value="Wohnort: " />
<p:inputText id="locationEdit" value="#{employeeEditController.employee.location}" />
<p:outputLabel for="streetEdit" value="Straße: " />
<p:inputText id="streetEdit" value="#{employeeEditController.employee.streetName}" />
<p:outputLabel for="postcodeEdit" value="Postleitzahl: " />
<p:inputMask id="postcodeEdit" mask="9999?9" slotChar=" " value="#{employeeEditController.employee.postcode}" />
<p:outputLabel for="phonenumberEdit" value="Telefonnummer: " />
<p:inputMask id="phonenumberEdit" mask="9?99999999999" slotChar=" " maxlength="12" value="#{employeeEditController.employee.phoneNumber}" />
<p:outputLabel for="emailEdit" value="Email: " />
<p:inputText id="emailEdit" validatorMessage="Ungültiges Email-Format!" value="#{employeeEditController.employee.email}">
<f:validateRegex pattern="^$|^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*#[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />
</p:inputText>
</h:panelGrid>
<p:separator/>
<h:panelGrid columns="6">
<p:outputLabel for="familyStatus" value="Familienstatus: " />
<p:selectOneMenu id="familyStatus" value="#{employeeEditController.employee.familyStatus}" style="width:150px">
<f:selectItem itemLabel="Wähle Familienstatus" itemValue="#{employeeEditController.employee.familyStatus}" />
<f:selectItems value="#{enumController.familyStatus}" />
</p:selectOneMenu>
<p:outputLabel for="Religion" value="Religion: " />
<p:selectOneMenu id="Religion" value="#{employeeEditController.employee.religion}" style="width:150px">
<f:selectItem itemLabel="Wähle Religion" itemValue="#{employeeEditController.employee.religion}" />
<f:selectItems value="#{enumController.religions}" />
</p:selectOneMenu>
<p:outputLabel for="Role" value="Rolle: " />
<p:selectOneMenu id="Role" value="#{employeeEditController.employee.workRole}" style="width:150px">
<f:selectItem itemLabel="Wähle Arbeitsrolle" itemValue="#{employeeEditController.employee.workRole}" />
<f:selectItems value="#{enumController.workRoles}" />
</p:selectOneMenu>
</h:panelGrid>
<p:separator/>
<h:panelGrid columns="3">
<p:commandButton value="Speichern" action="#{employeeEditController.doSaveEmployeeEdit()}" />
<p:commandButton value="Neu laden" action="#{employeeEditController.doReloadEmployee()}" />
<p:commandButton value="Abbruch" onclick="PF('employeeEditDialog').hide()" />
</h:panelGrid>
</p:outputPanel>
</p:dialog>
</h:form>
What can be the reason that html or whatever still do the validation and don't call the doSaveEmployeeEdit()?
UPDATE:
I made a new xhtml-file with same outputs - no validation anymore. But my controller method doesn't get called.
My children.xhtml:
<h:body>
<body class="theme-blue sidebar-mini sidebar-collapse">
<div class="wrapper">
<div class="content-wrapper" style="min-height: 1126px;">
<section class="content">
<div class="box">
<div class="box-body">
<h:form id="childForm">
<p:dataTable id="childTable" var="child" value="#{childController.children}">
<p:column headerText="Vorname">
<h:outputText value="#{child.firstName}" />
</p:column>
<p:column headerText="Nachname">
<h:outputText value="#{child.lastName}" />
</p:column>
<p:column headerText="Geburtsdatum">
<h:outputText value="#{child.birthday}" />
</p:column>
<p:column style="width:32px;text-align: center">
<p:commandButton update=":childForm:childEdit" oncomplete="PF('childEditDialog').show()" icon="ui-icon-note" title="Bearbeiten">
<f:setPropertyActionListener value="#{child}" target="#{childEditController.childEdit}" />
</p:commandButton>
</p:column>
</p:dataTable>
<p:dialog header="Kind bearbeiten" widgetVar="childEditDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false">
<p:messages autoUpdate="true" />
<p:outputPanel id="childEdit" style="text-align:center;">
<p:panelGrid columns="2" rendered="#{not empty childEditController.childEdit}" columnClasses="label,value">
<p:outputLabel id="primParent" value="primäres Elternteil:" />
<p:inputText for="primParent" value="#{childEditController.childEdit.primaryParent.id}" disabled="true" />
<p:outputLabel id="firstName" value="Vorname:" />
<p:inputText for="firstName" value="#{childEditController.childEdit.firstName}" />
<p:outputLabel id="lastName" value="Nachname:" />
<p:inputText for="lastName" value="#{childEditController.childEdit.lastName}" />
<p:outputLabel id="birthDay" value="Geburtsdatum:" />
<p:inputText for="birthDay" value="#{childEditController.childEdit.birthday}" />
<p:outputLabel id="emgNum" value="Notfallkontakt:" />
<p:inputText for="emgNum" value="#{childEditController.childEdit.emergencyNumber}" />
<p:outputLabel id="imgName" value="Bildname:" />
<p:inputText for="imgName" value="#{childEditController.childEdit.imgName}" />
<p:outputLabel for="gender" value="Geschlecht: " />
<p:inputText id="gender" value="#{childEditController.childEdit.gender}" disabled="true" />
<p:separator />
<h:panelGrid columns="3">
<p:commandButton value="Speichern" action="#{childEditController.doSaveChild}" update=":childForm:childTable" />
<p:commandButton value="Abbruch" onclick="PF('childEditDialog').hide()" immediate="true" />
</h:panelGrid>
</p:panelGrid>
</p:outputPanel>
</p:dialog>
</h:form>
</div>
</div>
</section>
</div>
</div>
</body>
</h:body>
My childEditController:
#Component
#Scope("request")
public class ChildEditController {
#Autowired
private ChildService childService;
private Child childEdit;
public Child getChildEdit() {
return childEdit;
}
public void setChildEdit(Child childEdit) {
this.childEdit = childEdit;
}
public void doSaveChild(){
childEdit = childService.saveChild(childEdit);
childEdit = null;
}
}
I have this .xhtml file. It's a data table page with three buttons (one for creating users, one for editing them and one for deleting them). Creating and deleting users are working but updating not. When I call the method actionListener="#{usuariosBean.actualizarUsuario}", I get all parameters well but not the Id, I'm getting 0 instead of the real Id of the user.
I have tried to do it in different .xhtml and it work good so I think that the problem is about the .xhtml file but... I don't know. Could anybody help me? Thanks a lot!!!
<?xml version='1.0' encoding='UTF-8' ?>
<!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:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<body>
<ui:composition template="./../template.xhtml">
<ui:define name="content">
<p:growl id="msgs" showDetail="true" />
<h:form>
<p:commandButton update=":formCrear" icon="ui-icon-document"
title="Crear Usuario" value="Crear Usuario"
oncomplete="PF('usuarioDialogCrear').show();">
</p:commandButton>
</h:form>
<h:form id="form">
<p:dataTable var="usuario" value="#{usuariosBean.usuarios}"
paginator="true" rows="10">
<p:column headerText="Id">
<h:outputText value="#{usuario.id}" />
</p:column>
<p:column headerText="Nombre de Usuario">
<h:outputText value="#{usuario.nombreDeUsuario}" />
</p:column>
<p:column headerText="Contraseña">
<h:outputText value="#{usuario.contrasenya}" />
</p:column>
<p:column headerText="Rol">
<h:outputText value="#{usuario.rol}" />
</p:column>
<p:column headerText="" style="text-align:center; width:4%">
<p:commandButton update=":form:usuarioActualizar" id="Actualizar"
icon="ui-icon-pencil" title="Actualizar"
oncomplete="PF('usuarioDialogActualizar').show();">
<f:setPropertyActionListener value="#{usuario}"
target="#{usuariosBean.usuarioSeleccionado}" />
</p:commandButton>
</p:column>
<p:column headerText="" style="text-align:center; width:4%">
<p:commandButton update=":form:usuarioEliminar" id="Eliminar"
icon="ui-icon-close" title="Eliminar"
oncomplete="PF('confirmacion').show();">
<f:setPropertyActionListener value="#{usuario}"
target="#{usuariosBean.usuarioSeleccionado}" />
</p:commandButton>
</p:column>
</p:dataTable>
<p:dialog header="Actualizar Usuario"
widgetVar="usuarioDialogActualizar" modal="true" showEffect="fade"
hideEffect="explode" resizable="false" width="400">
<p:outputPanel id="usuarioActualizar" style="text-align:center;"
layout="block">
<p:panelGrid columns="2">
<h:outputText value="Id " />
<p:inputText
value="#{usuariosBean.usuarioSeleccionado.id}"
style="font-weight:bold" size="37" />
<h:outputText value="Usuario: " />
<p:inputText
value="#{usuariosBean.usuarioSeleccionado.nombreDeUsuario}"
style="font-weight:bold" size="37" />
<h:outputText value="Contraseña: " />
<p:inputText
value="#{usuariosBean.usuarioSeleccionado.contrasenya}"
style="font-weight:bold" size="37" />
<h:outputText value="Rol " />
<p:inputText value="#{usuariosBean.usuarioSeleccionado.rol}"
style="font-weight:bold" size="37" />
</p:panelGrid>
</p:outputPanel>
<f:facet name="footer">
<p:commandButton update=":form, :msgs" id="btnActualizarAceptar"
icon="ui-icon-disk" title="Guardar Usuario"
value="Actualizar Usuario"
actionListener="#{usuariosBean.actualizarUsuario}"
oncomplete="PF('usuarioDialogActualizar').hide()">
</p:commandButton>
<p:commandButton id="btnActualizarCancelar" icon="ui-icon-close"
title="Cancelar" value="Cancelar" type="button"
onclick="PF('usuarioDialogActualizar').hide()">
</p:commandButton>
</f:facet>
</p:dialog>
<p:confirmDialog
message="¿Está seguro que desea eliminar el usuario?"
showEffect="bounce" hideEffect="explode" header="Eliminar Usuario"
severity="alert" widgetVar="confirmacion">
<p:outputPanel id="usuarioEliminar" style="text-align:center;"
layout="block">
<h:inputHidden value="#{usuariosBean.usuarioSeleccionado.id}" />
</p:outputPanel>
<p:commandButton id="confirmarDialogo" value="Aceptar"
icon="ui-icon-check" update=":form, :msgs"
oncomplete="PF('confirmacion').hide()"
actionListener="#{usuariosBean.eliminarUsuario}" />
<p:commandButton id="cancelarDialogo" icon="ui-icon-close"
title="Cancelar" value="Cancelar"
oncomplete="PF('confirmacion').hide()">
</p:commandButton>
</p:confirmDialog>
</h:form>
<h:form id="formCrear">
<p:dialog header="Crear Usuario" widgetVar="usuarioDialogCrear"
modal="true" showEffect="fade" hideEffect="explode"
resizable="false" width="400">
<p:outputPanel id="usuarioCrear" style="text-align:center;"
layout="block">
<p:panelGrid columns="2">
<h:outputText value="Usuario: " />
<p:inputText value="#{usuariosBean.nombreDeUsuario}"
required="true" size="37" />
<h:outputText value="Contraseña: " />
<p:inputText value="#{usuariosBean.contrasenya}" required="true"
size="37" />
<h:outputText value="Rol " />
<p:inputText value="#{usuariosBean.rol}" required="true"
size="37" />
</p:panelGrid>
</p:outputPanel>
<f:facet name="footer">
<p:commandButton update=":form, :msgs" id="btnCrearAceptar"
icon="ui-icon-disk" title="Guardar Usuario"
value="Guardar Usuario" action="#{usuariosBean.guardarUsuario}"
oncomplete="PF('usuarioDialogCrear').hide()">
</p:commandButton>
<p:commandButton id="btnCrearCancelar" icon="ui-icon-close"
title="Cancelar" value="Cancelar"
oncomplete="PF('usuarioDialogCrear').hide()">
</p:commandButton>
</f:facet>
</p:dialog>
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
Well, my problem is that no dialog inside my main page is called. I.E: I have a commandButton should call "varDialogFindPacientes" but don't work. I don't know what can i do to fix it.
Look my main page:
<!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: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"
xmlns:pe="http://primefaces.org/ui/extensions">
<h:head>
</h:head>
<h:body>
<ui:composition>
<p:dialog id="dialogCadastrar" width="900px" height="500px"
header="Cadastrar Orçamento" widgetVar="varDialogCadastrar"
modal="true" showEffect="fade" hideEffect="fade">
<h:form id="formCadastrar">
<p:panelGrid id="panelGridCadastar" styleClass="semBorda"
columns="2">
<h:outputText value="Data Emissão: " />
<p:inputText id="dataEmissao"
value="#{orcamentoMB.orcamento.dataEmissao}" readonly="true">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:inputText>
<h:outputText value="Data Validade: " />
<p:inputText id="dataValidade"
value="#{orcamentoMB.orcamento.dataValidade}" readonly="true">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:inputText>
<h:outputText value="Situação " />
<p:inputText id="situacao"
value="#{orcamentoMB.orcamento.situacao.descricao}"
readonly="true" />
<h:outputText value="Desconto (%): " />
<p:panelGrid columns="2" styleClass="semBorda">
<pe:inputNumber value="#{orcamentoMB.orcamento.desconto}"
id="desconto" symbol=" %" symbolPosition="suffix"
validatorMessage="O desconto não pode ser maior que #{orcamentoMB.maxDesconto} %">
<f:validateDoubleRange maximum="#{orcamentoMB.maxDesconto}" />
</pe:inputNumber>
<p:commandButton value="Recalcular" process="desconto"
icon="ui-icon-refresh"
update=":formCadastrar:totalGeral, :formCadastrar:totalGeralComDesconto" />
</p:panelGrid>
<h:outputText value="Observação: " />
<p:inputTextarea value="#{orcamentoMB.orcamento.observacoes}"
rows="5" cols="30" />
<h:outputText value="Dentista: *" />
<p:panel style="border:1px solid #e5e5e5;">
<p:inputText required="true"
requiredMessage="Selecione um dentista"
value="#{orcamentoMB.orcamento.dentistaOrcou.pessoaFisica.nome}"
readonly="true" size="30" id="dentistaOrcou" />
<p:commandButton icon="ui-icon-search" type="button"
onclick="varDialogFindDentistas.show()" />
</p:panel>
<h:outputText value="Paciente *" />
<p:panel style="border:1px solid #e5e5e5;">
<p:inputText required="true"
requiredMessage="Selecione um paciente"
value="#{orcamentoMB.orcamento.paciente.pessoaFisica.nome}"
readonly="true" size="30" id="paciente" />
<p:commandButton icon="ui-icon-search" type="button"
onclick="varDialogFindPacientes.show()" />
</p:panel>
</p:panelGrid>
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton value="Add" icon="ui-icon-plus"
onclick="varDialogFindItensTabela.show()" type="button"
update=":formCadastrar:dataTableItens, :formCadastrar:salvarAceitando,:formCadastrar:salvarSemAceitar, :formCadastrar:totalGeral,
:formCadastrar:totalGeralComDesconto" />
<p:commandButton value="Del" icon="ui-icon-minus"
disabled="#{orcamentoMB.selectedItemOrcamento == null}"
actionListener="#{orcamentoMB.delItemOrcamento}"
update=":formCadastrar:dataTableItens, :formCadastrar:totalGeral,
:formCadastrar:totalGeralComDesconto, :formCadastrar:salvarAceitando,:formCadastrar:salvarSemAceitar" />
</p:toolbarGroup>
</p:toolbar>
<p:dataTable rowKey="#{item}" var="item"
value="#{orcamentoMB.itens}"
emptyMessage="Não foi encontrado nenhum registro"
id="dataTableItens"
selection="#{orcamentoMB.selectedItemOrcamento}"
selectionMode="single" rowIndexVar="rowIndex"
rowStyleClass="#{(rowIndex mod 2) eq 0 ? 'first-row' : 'second-row'}">
<p:column headerText="Nome"
sortBy="#{item.itemTabelaProcedimento.procedimento.nome}"
id="nome">
<h:outputText
value="#{item.itemTabelaProcedimento.procedimento.nome}" />
</p:column>
<p:column headerText="Valor"
sortBy="#{item.itemTabelaProcedimento.valor}" id="valor">
<h:outputText value="#{item.itemTabelaProcedimento.valor}">
<f:convertNumber currencySymbol="R$ " type="currency" />
</h:outputText>
</p:column>
<p:column headerText="Local Aplicação"
sortBy="#{item.localAplicacao.descricao}" id="localAplicacao">
<h:outputText value="#{item.localAplicacao.descricao}" />
</p:column>
<p:column headerText="Dente" sortBy="#{item.dente.descricao}"
id="dente">
<h:outputText value="#{item.dente.descricao}" />
</p:column>
<p:column headerText="Face"
sortBy="#{item.faceAplicacao.descricao}" id="face">
<h:outputText value="#{item.faceAplicacao.descricao}" />
</p:column>
</p:dataTable>
<p:panelGrid columns="2">
<h:outputText value="Total Geral: " />
<h:outputText value="#{orcamentoMB.totalGeral}" id="totalGeral">
<f:convertNumber currencySymbol="R$ " type="currency" />
</h:outputText>
<h:outputText value="Total Com Desconto: " />
<h:outputText value="#{orcamentoMB.totalGeralComDesconto}"
id="totalGeralComDesconto">
<f:convertNumber currencySymbol="R$ " type="currency" />
</h:outputText>
</p:panelGrid>
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton icon="ui-icon-disk" value="Salvar Sem Aceitar"
id="salvarSemAceitar" disabled="#{orcamentoMB.itens.size() == 0}"
actionListener="#{orcamentoMB.salvar}"
oncomplete="if (!args.validationFailed){ varDialogCadastrar.hide() }"
update=":formOrcamentos:dataTableOrcamentos">
<f:attribute name="salvarAceitando" value="false" />
</p:commandButton>
<p:commandButton icon="ui-icon-disk" value="Salvar Aceitando"
id="salvarAceitando" disabled="#{orcamentoMB.itens.size() == 0}"
actionListener="#{orcamentoMB.salvar}"
oncomplete="if (!args.validationFailed){ varDialogCadastrar.hide() }"
update=":formOrcamentos:dataTableOrcamentos">
<f:attribute name="salvarAceitando" value="true" />
</p:commandButton>
<p:commandButton value="Cancelar" icon="ui-icon-close"
onclick="varDialogCadastrar.hide()" type="button" />
</p:toolbarGroup>
</p:toolbar>
</h:form>
</p:dialog>
</ui:composition>
</h:body>
</html>
So, i'll show a page the is called for "varDialogFindPacientes"
<!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: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:head>
</h:head>
<h:body>
<ui:composition>
<p:dialog id="dialogFindPacientes" width="600px" height="auto"
header="Pesquisar Pacientes" widgetVar="varDialogFindPacientes"
modal="true" showEffect="fade" hideEffect="fade">
<h:form id="formFindPacientes">
<p:dataTable rowKey="#{paciente.id}" var="paciente"
value="#{orcamentoMB.pacientes}" paginator="true"
emptyMessage="Não foi encontrado nenhum registro" rows="20"
id="dataTablePacientes" selection="#{orcamentoMB.selectedPaciente}"
selectionMode="single" rowIndexVar="rowIndex"
rowStyleClass="#{(rowIndex mod 2) eq 0 ? 'first-row' : 'second-row'}"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}">
<p:ajax event="rowDblselect" process="dataTablePacientes"
listener="#{orcamentoMB.updatePacienteFromFind}"
oncomplete="dialogFindPacientes.hide()"
update=":formCadastrar:paciente" />
<p:column headerText="Nome" sortBy="#{paciente.pessoaFisica.nome}"
filterBy="#{paciente.pessoaFisica.nome}" id="nome"
filterMatchMode="contains">
<h:outputText value="#{paciente.pessoaFisica.nome}" />
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
</ui:composition>
</h:body>
</html>
EDIT 1:
I have another problem yet, the #PostConstruct from my ManagedBean is called every ajax call.
Action method is not working in my <p:menuitem>. I would like to change activeIndex via an action method of <p:menuitem>.
The code below is the code on template page that is used in my pages:
<h:form>
<p:tabMenu activeIndex="#{loginBean.activeindex}">
<p:menuitem value="Home" url="Menu.jsf" icon="ui-icon-star" />
<p:menuitem value="Fabricants" url="/pagess/pagesFabricant/Fabricant.jsf" icon="ui-icon-wrench" action="#{loginBean.Dirige(1)}" />
<p:menuitem value="Composants" url="/pagess/pagesComposant/Composant.jsf" icon="ui-icon-search" action="#{loginBean.Dirige(2)}"/>
<p:menuitem value="Dossier d'equivalence" url="DEQ.jsf" icon="ui-icon-document" action="#{loginBean.Dirige(3)}"/>
</p:tabMenu>
</h:form>
This is my bean:
public class LoginBean {
private int activeindex;
public int getActiveindex() {
return activeindex;
}
public void setActiveindex(int activeindex) {
this.activeindex = activeindex;
}
public void Dirige(int a){
setActiveindex(a);
}
}
When I click on any menu item the action method is not called. I did some debugging to ensure that the method is not called. Alternatively, the method is working with <p:commandButton>.
This is the template
<!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:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<ui:insert name="title">Title</ui:insert></title>
</h:head>
<h:body>
<h:form>
<p:tabMenu activeIndex="#{loginBean.activeindex}">
<p:menuitem value="Home" url="Menu.jsf" icon="ui-icon-star" />
<p:menuitem value="Fabricants" url="/pagess/pagesFabricant/Fabricant.jsf" icon="ui-icon-wrench" action="#{loginBean.Dirige(1)}" />
<p:menuitem value="Composants" url="/pagess/pagesComposant/Composant.jsf" icon="ui-icon-search" action="#{loginBean.Dirige(2)}"/>
<p:menuitem value="Dossier d'equivalence" url="DEQ.jsf" icon="ui-icon-document" action="#{loginBean.Dirige(3)}"/>
</p:tabMenu>
</h:form>
<p/>
<table border="5" align="center">
<tr><th class="title">
Bienvenue #{loginBean.username} dans Notre application Ipertool
</th></tr>
</table><p/>
<ui:insert name="body">Body</ui:insert>
<p:separator id="separator"/>
<ui:include src="/templates/includes/footer.xhtml"/>
</h:body>
</html>
This is page Fabricant when I press menuitem Fabricant
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
template="/templates/template.xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:define name="title">Liste Fabricants</ui:define>
<ui:define name="body">
<h:form id="form">
<p:growl id="growl" showDetail="true"/>
<p:commandLink value="Ajouter Fabricant" action="#{fabricantbean.Ajouter()}"><img src="/image/ajout.jpg" alt= "Ajouter"></img></p:commandLink>
<p:dataTable id="cars" var="fab" value="#{fabricantbean.list}" paginator="true" rows="10" rowKey="#{fab.idFabricant}"
selection="#{fabricantbean.selectitem}" selectionMode="single" emptyMessage="Aucun Fabricants Trouve">
<p:ajax event="rowSelect" listener="#{fabricantbean.onRowSelect}"
update=":form:dialog :form:growl" oncomplete="carDialog.show()" />
<p:column id="modelColumn" filterBy="#{fab.nomFabricant}"
headerText="Nom Fabricant" footerText="contains"
filterMatchMode="contains">
<h:outputText value="#{fab.nomFabricant}" />
</p:column>
<p:column>
<f:facet name="header">
Lien Site
</f:facet>
<h:outputText value="#{fab.lienSite}" />
</p:column>
<p:column>
<f:facet name="header">
Staut Fabricant
</f:facet>
<h:outputText value="#{fab.statutFabricant}" />
</p:column>
<p:column>
<f:facet name="header">
Nom Contact
</f:facet>
<h:outputText value="#{fab.nomContact}" />
</p:column>
<p:column>
<f:facet name="header">
Mail Contact
</f:facet>
<h:outputText value="#{fab.mailContact}" />
</p:column>
<p:column>
<f:facet name="header">
Action
</f:facet>
<p:commandButton value="Modifier" action="#{fabricantbean.Modifier()}">
<f:setPropertyActionListener target="#{fabricantbean.selectitem}" value="#{fab}" />
</p:commandButton>
<p:commandButton value="Supprimer" onclick="info.show()" >
<f:setPropertyActionListener target="#{fabricantbean.selectitem}" value="#{fab}" />
</p:commandButton>
</p:column>
</p:dataTable>
<p:confirmDialog id="infodialoge" message="Si vous supprimer ce Fabricant vous resquer de supprimer ces composant ainsi les DEQ"
header="supprimer Fabricant" severity="alert" widgetVar="info">
<p:commandButton id="confirm" value="Oui Sure" oncomplete="info.hide()"
action="#{fabricantbean.supprimer()}" update="form:cars"/>
<p:commandButton id="decline" value="Non " onclick="info.hide()" type="button" />
</p:confirmDialog>
<p:dialog id="dialog" header="Fabricant Detail" widgetVar="carDialog" resizable="false" dynamic="true"
showEffect="fade" hideEffect="explode">
<h:panelGrid id="display" columns="2" cellpadding="4">
<f:facet name="header">
<p:graphicImage value="/images/cars/#{tableBean.selectedCar.manufacturer}.jpg"/>
</f:facet>
<h:outputText value="lien Reach:" />
<h:outputText value="#{fabricantbean.selectitem.lienReach}" />
<h:outputText value="lien Fmd:" />
<h:outputText value="#{fabricantbean.selectitem.lienFmd}" />
<h:outputText value="lien Rohs:" />
<h:outputText value="#{fabricantbean.selectitem.lienRohs}" />
<h:outputText value="lien cofc:" />
<h:outputText value="#{fabricantbean.selectitem.fichierCofc}" />
<h:outputText value="remarque:" />
<h:outputText value="#{fabricantbean.selectitem.remarqueFabricant}" />
</h:panelGrid>
</p:dialog>
</h:form>
</ui:define>
</ui:composition>
the problem is in fact the url in your menuitem.
You have to edit your Dirige method.
Try the following:
public String Dirige(int a){
setActiveindex(a);
if (a == 1) {
return "/pagess/pagesFabricant/Fabricant.jsf";
}else{
if (a == 2) {
return "/pagess/pagesComposant/Composant.jsf";
}else{
...
}
}
}
and in your template you have to remove the url-Tags:
<h:form>
<p:tabMenu activeIndex="#{loginBean.activeindex}">
<p:menuitem value="Home" url="Menu.jsf" icon="ui-icon-star" />
<p:menuitem value="Fabricants" icon="ui-icon-wrench" action="#{loginBean.Dirige(1)}" />
<p:menuitem value="Composants" icon="ui-icon-search" action="#{loginBean.Dirige(2)}"/>
<p:menuitem value="Dossier d'equivalence" icon="ui-icon-document" action="#{loginBean.Dirige(3)}"/>
</p:tabMenu>
</h:form>