Primefaces p:dialog does not showing up - jsf-2

I am trying show within the p:dialog-element the p:fileUpload- Element.
Without the p:fileUpload -Element the p:dialog is showing up. Then I add the fileUpload-Tag
and it does nothing. I am using Tomcat 7, mojorra 2.1.28, primefaces 5.0.
<ui:composition
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
template="WEB-INF/templates/template.xhtml"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui">
<!--Zusätzliches Stylesheet-->
<ui:define name="additionalCSS"> <link rel="stylesheet" type="text/css" href="resources/style/benutzer.css" /> </ui:define>
<!--Titel-->
<ui:define name="title">Ticket schreiben</ui:define>
<!--Hier beginnt der Content-Bereich, der je nach Client variiert-->
<ui:define name="content">
<div id="content">
<div id="verlauf">
<h:form>
<h:commandLink value="Home" action="#{linkController.goHome}"> </h:commandLink> /
<h:commandLink value="Tickets" action="#{linkController.goTicketindex}"></h:commandLink> /
<h:commandLink value="Neues Ticket erstellen" action="#{linkController.goTicketcreate}"></h:commandLink>
</h:form>
</div>
<div id="headline">Neues Ticket erstellen</div>
<h:form>
<div id="stats">
<div id="title">Empfänger</div>
<div class="inputName">An:</div>
<div class="inputContent"> <h:inputText id="user" styleClass="inputText" value="#{ticketController.adress}" >
<!-- validatorMessage="Bitte geben Sie den Empfänger an." >
<f:validateRequired/>-->
</h:inputText> </div>
<div class="inputName">Betreff:</div>
<div class="inputContent"> <h:inputText id="topic" styleClass="inputText" value="#{ticketController.topic}"
></h:inputText> </div>
</div>
<div id="rechte">
<div id="title">Nachricht</div>
<div class="column">
<div class="inputArea"> <h:inputTextarea id="message" styleClass="inputField" value="#{ticketController.message}" >
<!-- validatorMessage="Bitte geben Sie eine Nachricht ein." >
<f:validateRequired/>-->
</h:inputTextarea> </div>
</div>
<br/>
<p:dialog widgetVar="dialogVar" modal="true" minHeight="100" draggable="true" >
<p:fileUpload fileLimit="20000" fileLimitMessage="File ist zu groß" fileUploadListener="#{ticketController.fileUploadHandler}"></p:fileUpload>
</p:dialog>
<h:commandButton value="Datei Uploaden" type="button" styleClass="submitButton" onclick="dialogVar.show()"></h:commandButton>
<h:commandButton value="Anlegen" type="submit" styleClass ="submitButton"
action="#{ticketController.createNewTicket}"></h:commandButton>
</div>
</h:form>
</div>
</ui:define>
</ui:composition>
I tried PF('dialogVar').show and dialogVar.show(), but it is not showing up.

I think you must add inside your dialog. After generating code,despite what you see in your xhtml page, the dialog will be outside of your form,therefore you need to add it yourself.
try the following code:
<ui:define name="content">
<div id="content">
<div id="verlauf">
<h:form>
<h:commandLink value="Home" action="#{linkController.goHome}"/>
<h:commandLink value="Tickets" action="#{linkController.goTicketindex}"/>
<h:commandLink value="Neues Ticket erstellen" action="#{linkController.goTicketcreate}"/>
</h:form>
</div>
<div id="headline">Neues Ticket erstellen</div>
<h:form>
<div id="stats">
<div id="title">Empfänger</div>
<div class="inputName">An:</div>
<div class="inputContent">
<h:inputText id="user" styleClass="inputText" value="#{ticketController.adress}" />
</div>
<div class="inputName">Betreff:</div>
<div class="inputContent">
<h:inputText id="topic" styleClass="inputText" value="#{ticketController.topic}"
></h:inputText> </div>
</div>
<div id="rechte">
<div id="title">Nachricht</div>
<div class="column">
<div class="inputArea"> <h:inputTextarea id="message" styleClass="inputField" value="#{ticketController.message}" >
<!-- validatorMessage="Bitte geben Sie eine Nachricht ein." >
<f:validateRequired/>-->
</h:inputTextarea> </div>
</div>
<br/>
<h:commandButton value="Datei Uploaden" type="button" styleClass="submitButton" onclick="dialogVar.show()"></h:commandButton>
<h:commandButton value="Anlegen" type="submit" styleClass ="submitButton"
action="#{ticketController.createNewTicket}"></h:commandButton>
</div>
</h:form>
<p:dialog widgetVar="dialogVar" modal="true" minHeight="100" draggable="true" >
<h:form>
<p:fileUpload fileLimit="20000" appendToBody="false" fileLimitMessage="File ist zu groß" fileUploadListener="#{ticketController.fileUploadHandler}"/>
</h:form>
</p:dialog>
</div>

Related

p:commandButton p:confirm actionListener not triggering

Primefaces actionListener is not working in p:confirmDialog . Can someone help? The saveRecord works fine in a simple dialog box.
<p:commandButton value="Save" actionListener="#{EmployeeDetailsComponent.displayInfo}">
<p:confirm header="Attention" message="test" icon="ui-icon-alert" />
</p:commandButton>
<p:confirmDialog global="true" showEffect="fade" hideEffect="explode" appendToBody="true">
<p:commandButton value="Save" action="#{TestComponent.saveRecord(TestComponent.testData)}" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="Cancel" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>
You have appendToBody="true", which means there is no <h:form> to handle the click because the whole dialog content is moved directly under body. Just add the form inside the dialog.
<p:confirmDialog global="true" showEffect="fade" hideEffect="explode" appendToBody="true">
<h:form>
<p:commandButton value="Save" action="#{TestComponent.saveRecord(TestComponent.testData)}" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="Cancel" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</h:form>
</p:confirmDialog>
I just add a div to center the buttons and the process and the action works perfectly, example code with primefaces 5.1:
<p:confirmDialog global="true" showEffect="clip" >
<div align="center">
<p:commandButton value="Aceptar" actionListener="#{bienvenidoUI.asignarPSI()}" update="tablaProceso" icon="ui-icon-check" process="#this" styleClass="ui-confirmdialog-yes"/>
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</div>
</p:confirmDialog>
and I just call the confirmDialog from inside a table with:
<p:commandButton icon="ui-icon-circle-check" title="Asignar PSI" rendered="#{bienvenidoUI.usr.idUsuario==bienvenidoUI.autorizadorId and min.estado.descripcion=='Proceso'}">
<f:setPropertyActionListener value="#{min}" target="#{bienvenidoUI.minutaSelected}" />
<p:confirm header="Confirmación" message="Esta seguro que desea asignar psi?" icon="ui-icon-alert" />
</p:commandButton>
remove appendToBody="true" from the confirm dialog component and enclose Save command buttton with in form.
<!DOCTYPE html>
<f:view xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<html lang="en">
<h:head>
</h:head>
<h:body id="top">
<h:form>
<p:commandButton value="Save" actionListener="#{simpleBean.displayInfo}" action="#{simpleBean.saveRecord}">
<p:confirm header="Attention" message="test" icon="ui-icon-alert" />
</p:commandButton>
</h:form>
<p:confirmDialog closeOnEscape="true" global="true" showEffect="fade" hideEffect="explode">
<p:commandButton value="Save" type="button" styleClass="ui-confirmdialog-yes"/>
<p:commandButton value="Cancel" type="button" styleClass="ui-confirmdialog-no"/>
</p:confirmDialog>
</h:body>
</html>
</f:view>
SimpleBean.java
#Named("simpleBean")
public class SimpleBean implements Serializable{
public void displayInfo(){
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Display Info works");
}
public String saveRecord(){
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Save Record works");
return null;
}
}

To display validation message in primefaces dialog from managed bean

i am trying to display the message of the outcome of a validation done in managed bean in the dialog but it is not getting displayed in the dialog on submit of the form.
Please help me in fixing this
My JSF page snippet with dialog
<p:dialog header="Add LPC" id="lpcDlg" widgetVar="dlg" rendered="true"
appendToBody="true" resizable="true" modal="true" height="320px"
width="38%">
<h:form id="addLpc">
<div align="center" style="margin-bottom: 1px; padding-bottom: 1px;">
<h:outputLabel value="Add New LPC"
style="font-color:#000000;font-weight:bold;font-size:24px;padding-bottom:1px;"></h:outputLabel>
</div>
<div align="center">
<p:messages id="lpcDlgMsg" showDetail="false" autoUpdate="true"
closable="true" />
<p:messages id="lpcDlgMsg2" for="lpcDlgMessage" showDetail="false"
autoUpdate="true" closable="true" />
<h:panelGrid id="addLpcForm" columns="2" appendToBody="true">
<h:outputText value="LPC ID" />
<p:inputText id="lpcId" value="#{lpcBean.lpcId}" required="true"
requiredMessage="LPC ID is required">
<f:ajax event="blur" render="lpcDlgMsg" />
</p:inputText>
<h:outputText value="First Name" />
<p:inputText id="firstName" value="#{lpcBean.firstName}" />
.
.
.
.
</h:panelGrid>
</div>
<div align="center">
<p:commandButton id="submitButton" value="Submit" ajax="true"
update=":lpcForm:lpcDataTable,addLpc"
action="#{lpcBean.formSubmit}" oncomplete="dlg.hide()" />
<p:commandButton id="cancelButton" value="Cancel"
onclick="dlg.hide()" />
</div>
</h:form>
</p:dialog>
message with id lpcDlgMsg2 is the message i am trying to display on submit.The other message is getting displayed correct on blur.
Snippet of the method that is called on submit
public void formSubmit()
{
if(resultSet.next())
{
int lpcIdCount=rs.getInt("lpcCount");
if(lpcIdCount!=0)
{
FacesContext.getCurrentInstance().addMessage("lpcDlgMessage", new FacesMessage(FacesMessage.SEVERITY_ERROR," ", "Duplicate LPCID"));
System.out.println("after display");
}
else
{
.
.
.
.
}
}
}
}
Here is my suggestion:
<p:dialog header="Add LPC" id="lpcDlg" widgetVar="dlg" rendered="true"
appendToBody="true" resizable="true" modal="true" height="320px"
width="38%">
<h:form id="addLpc">
<div align="center">
<p:messages id="lpcDlgMsg" showDetail="false" autoUpdate="true"
closable="true" />
<h:panelGrid id="addLpcForm" columns="2" >
<h:outputText value="LPC ID" />
<p:inputText id="lpcId" required="true" />
<h:outputText value="First Name" />
<p:inputText id="firstName" required="true" />
</h:panelGrid>
</div>
<div align="center">
<p:commandButton id="submitButton" value="Submit"
oncomplete="if (!args.validationFailed){dlg.hide();}" />
<p:commandButton id="cancelButton" value="Cancel"
onclick="dlg.hide()" />
</div>
</h:form>
</p:dialog>
Note that I've simplified your code in order to avoid using a managedbean.
If you want your managed bean to perform the validation, use RequestContext to conditionally execute the code that will close the dialog and remove the oncomplete from Submit button.
if (success) {
RequestContext.getCurrentInstance().execute("dlg.hide()");
}else{
//show all the messages you need here
}
You have to add this javascript first inside head tag
function handleComplete(xhr, status, args) {
if (!args.validationFailed) {
dlg.hide();
} else {
}
}
More changes are
<p:commandButton id="submitButton" value="Submit" ajax="true"
update=":lpcForm:lpcDataTable,addLpc :lpcDlgMsg2"
actionListener="#{lpcBean.formSubmit}" oncomplete="handleComplete(xhr, status, args)" />
action to actionListener because action has String return type.
This will work fine.

reset inputtext on change of selectOneMenu

I want to clear the inputText when user select "select country admin" in selecOneMenu, I am able to do this by changing itemValue=" " but it fails for rquired="true" condition on submit
<h:selectOneMenu id="eidx" value="#{countryBean.selectedEid}" required="#{!countryBean.isEditMode}"
requiredMessage="#{msg['country.label.validation.select.countryadmin']}" >
<f:selectItem itemLabel="Select Country Admin" itemValue="#{null}"/>
<f:selectItem itemLabel="Add New User" itemValue="1"/>
<f:selectItems value="#{countryBean.allUserDetails}" var="user" itemLabel="#{user.lastName}, #{user.firstName} | (#{user.eid})" itemValue="#{user.eid}"/>
<p:ajax listener="#{countryBean.getUserDetail}" process="#this" update="userDetailPanel" onstart="statusDialog.show();" oncomplete="statusDialog.hide();"/>
</h:selectOneMenu>
</div>
<h:panelGroup id="userDetailPanel">
<div class="clear"> </div>
<div class="form-label">
<label title="EID" for="EID">#{msg['country.label.EID']}</label>
</div>
<div class="form-field" >
<h:inputText id="eidPX" value="#{countryBean.usersDetailsDTO.eid}" disabled="#{not(countryBean.selectedEid eq '1')}" resetValues="true">
<f:validator validatorId="regexVal"/>
</h:inputText>
</div>
<div class="clear"> </div>
<div class="form-label">
<label title="EID" for="EID">#{msg['country.label.FirstName']}</label>
</div>
<div class="form-field" >
<h:inputText validatorMessage="#{msg['country.label.validation.select.first.name']}" required="#{(countryBean.selectedEid eq '1')}" requiredMessage="Enter first Name" value="#{countryBean.usersDetailsDTO.firstName}" id="empFName" disabled="#{not(countryBean.selectedEid eq '1')}">
<f:validator validatorId="nameValidation" />
</h:inputText>
</div>
<div class="clear"> </div>
<div class="form-label">
<label title="EID" for="EID">#{msg['country.label.lastname']}</label>
</div>
I have done this by using javascript
document.getElementById("eidx").value="";

Unable to show faces message on xhtml page

I am unable to show faces messages using facesMessage
Bean code :
if(condition){
FacesContext fc=FacesContext.getCurrentInstance();
fc.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_FATAL,"Rounding Rule Saved","R Saved"));
}
View code :
<p:messages autoUpdate="true" showDetail="true" globalOnly="true" id="msgId"/>
But I am not getting messages, what am I doing wrong?
EDIT:
My project flow is :
User click on edit button on view page
Redirect to edit page
After submitting return to view page
Render message(which I am not getting)
View code (rouning_rule_master.xhtml) :
<!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:c="http://java.sun.com/jsp/jstl/core"
>
<ui:composition template="/pages/webEx_Template.xhtml">
<ui:define name="content">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Rounding Rule Master</title>
<link rel="stylesheet" type="text/css" href="../css/rounding_rule_master.css" />
</h:head>
<h:body>
<div class="wrapper">
<div class="page_wrapper">
<div class="page_heading border_bottom">Rounding Rule Master</div>
<div class="form_div">
<h:form id="roundingMasterFormId" >
<p:messages autoUpdate="true" showDetail="true" globalOnly="true" id="MESSAGEID"/>
<div class="form_detail">
<div class="float_right">
<h:commandButton id="creataeBtn" action="#{roundingBean.createRoundingRule}" value="Create Rounding Rule" class="createRelation" >
<p:ajax onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>
</h:commandButton>
</div>
<div class="clear"></div>
<div style="margin:10px 0;">
<table id="roundingMasterTableId" width="100%" cellspacing="1" cellpadding="0" border="0" class="role_detail_section">
<thead>
<tr>
<th>Rounding Rule Id</th>
<th>Rounding Rule Name</th>
<th>Rounding Mode</th>
<th>Rounding Constant</th>
<th class="action">Action</th>
</tr>
</thead>
<tbody>
<c:forEach items="#{roundingBean.roundingRuleList}" var="var" >
<tr>
<h:inputHidden value="#{var.roundingRuleId}" />
<td><h:outputText value="#{var.roundingRuleId}" /></td>
<td><h:outputText value="#{var.roundingRuleName}" /></td>
<td><h:outputText value="#{var.roundingMode.roundingModeName}" /></td>
<td><h:outputText value="#{var.roundingIncrement}" /></td>
<td>
<p:commandLink value="Edit" styleClass="edit_icon" action="#{roundingBean.editRoundingRule (var,true)}" immediate="true" process="#this" onstart="statusDialog.show();" onsuccess="statusDialog.hide();">
</p:commandLink>
<p:commandLink id="deleteId" styleClass="remove_icon" action="#{roundingBean.deleteRoundingRule(var.roundingRuleId)}" immediate="true" update="#form" process="#this" oncomplete="addCSS()" onstart="statusDialog.show();" onsuccess="statusDialog.hide();">
<p:confirm header="Confirmation" message="Are you sure want to delete rounding rule ?" icon="ui-icon-alert" />Delete
</p:commandLink>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
<p:confirmDialog styleClass="confirm" global="true" showEffect="fade" draggable="false" closable="false" resizable="false" width="400">
<p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes"/>
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no"/>
</p:confirmDialog>
<p:dialog styleClass="confirm" modal="true" widgetVar="statusDialog" header="Loading..."
draggable="false" closable="false" resizable="false" width="100"
height="50">
<div align="center">
<p:graphicImage value="../images/loading.gif" width="50"
height="50" />
</div>
</p:dialog>
</h:form>
</div>
</div>
</div>
</h:body>
</ui:define>
</ui:composition>
</html>
I am not sure if it is your case. But if you redirect after generating the Messages, they are lost in the redirect process. You need to make sure there is no redirect in the faces config - or any other mean - in your page flow.

Facelet tag component block fire primefaces commandButton action and actionListener

I create facelet tag component, glue:input and glue:group
input.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:ocp="http://java.sun.com/jsf/composite/ocpcommon"
>
<c:set var="id" value="#{not empty id ? id : (not empty name ? name : action)}" />
<c:set var="required" value="#{not empty required and required}" />
<c:set var="render" value="#{not empty render ? 'panel-group-'.concat(render) : (not empty id ? 'panel-group-'.concat(id) : 'panel-group-'.concat(mame))}" />
<c:set var="validator" value="#{not empty validator ? validator : 'safeTextValidator'}" />
<h:panelGroup id="panel-group-#{id}" layout="block" class="clearfix">
<label for="#{name}" class="#{(not empty required and required) ? 'required' : ''}">#{label}#{(not empty required and required) ? '* ' : ''}</label>
<div class="input">
<c:choose>
<c:when test="#{type == 'java.lang.String' or type == 'text'}">
<h:inputText value="#{value}" id="#{name}" styleClass="xLarge span4" required="#{required}" label="#{label}">
<f:validator validatorId="#{validator}"/>
<f:ajax execute="#{execute}" render="#{render}" />
</h:inputText>
</c:when>
<c:when test="#{type == 'java.util.Date' or type == 'calendar'}">
<p:calendar value="#{a.value}" id="#{name}" navigator="true" label="#{label}">
<p:ajax event="dateSelect" listener="#{listener}" update="panel-group-#{id}" />
</p:calendar>
</c:when>
<c:when test="#{type == 'checkbox'}">
<h:selectBooleanCheckbox value="#{value}" id="#{name}" styleClass="xLarge" required="#{required}" label="#{label}">
<f:ajax execute="#{execute}" render="#{render}" />
</h:selectBooleanCheckbox>
<span>#{inlinehelp}</span>
</c:when>
<c:when test="#{type == 'textarea'}">
<h:inputTextarea value="#{value}" id="#{name}" styleClass="xLarge span4" required="#{required}" label="#{label}" style="width: 400px; height: 100px;" >
<f:ajax execute="#{execute}" render="#{render}" />
</h:inputTextarea>
</c:when>
<c:when test="#{type == 'org.eqaula.glue.model.Catalogue' or type == 'select'}">
</c:when>
<c:otherwise>
<h:inputText value="#{value}" id="#{name}" styleClass="xLarge span4" required="#{required}" label="#{label}">
<f:ajax execute="#{execute}" render="#{render}" />
</h:inputText>
</c:otherwise>
</c:choose>
<h:graphicImage value="#{resource['success.gif']}" rendered="#{value != null}"
styleClass="validation-status" />
<span class="help-inline"><br/>#{inlinehelp} <ocp:message forId="#{name}" /></span>
</div>
</h:panelGroup>
</ui:composition>
group.xhtml
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:ocp="http://java.sun.com/jsf/composite/ocpcommon"
>
<c:set var="id" value="#{not empty id ? id : (not empty name ? name : action)}" />
<c:set var="required" value="#{not empty required and required}" />
<c:set var="group" value="#{not empty group ? group : null}" />
<h:panelGroup id="panel-group-#{id}" layout="block" class="clearfix">
<label for="#{name}" class="#{(not empty required and required) ? 'required' : ''}">#{label}#{(not empty required and required) ? '* ' : ''}</label>
<div class="input">
<p:commandButton id="button-#{id}" action="#{controller[addAction]}" process="#this"
value="#{messages['common.add']} #{label}" ajax="true"
icon="ui-icon-plus" update="group-data-table-#{id}"/>
<p:dataTable var="m" value="#{group.members}" id="group-data-table-#{id}"
editable="true" rendered="#{not empty group.members}"
selection="#{controller[bussinesEntity]}" >
<f:facet name="header">
#{group.attribute.label}
</f:facet>
<!-- //TODO activar ajax
<p:ajax event="rowEdit" listener="#{controller[editListener]}" update=":form:messages" />
<p:ajax event="rowEditCancel" listener="#{tableBean.onCancel}" update=":form:messages" />
-->
<p:column headerText="#{messages['common.name']}" style="width:125px">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{m.name}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{m.name}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="#{messages['common.options']}" style="width:50px">
<p:rowEditor />
</p:column>
</p:dataTable>
</div>
</h:panelGroup>
</ui:composition>
The input and group tags rendered well in this page, inclusive input tag works fine in Save button:
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:p="http://primefaces.org/ui"
xmlns:s="http://jboss.org/seam/faces"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:glue="http://eqaula.org/jsf/facelets"
xmlns:ocp="http://java.sun.com/jsf/composite/ocpcommon">
<ui:composition template="/WEB-INF/view/templates/glue.xhtml">
<ui:define name="content">
<f:metadata>
<f:viewParam name="id" value="#{profileHome.profileId}" />
<s:viewAction action="#{profileHome.load}" if="#{conversation.transient}"/>
</f:metadata>
<h2>#{messages['common.edit']} #{messages['Profile']}: #{profileHome.instance.fullName}</h2>
<h:form id="profile">
<div class="actions">
<h:commandButton id="save" action="#{profileHome.saveAjax()}" value="#{messages['common.save']}" styleClass="btn primary"/>
<h:commandButton action="/pages/home.xhtml?faces-redirect=true"
value="#{messages['common.cancel']}" styleClass="btn" immediate="true"/>
</div>
<!-- Attributos para usuario -->
<glue:input id="fstn" name="firstname" type="text" label="#{messages['common.firstname']}" value="#{profileHome.instance.firstname}" required="true" inlinehelp="#{messages['common.firstname.inlinehelp']}" execute="#this save" render="fstn"/>
<glue:input id="srn" name="surname" type="text" label="#{messages['common.surname']}" value="#{profileHome.instance.surname}" required="true" inlinehelp="#{messages['common.surname.inlinehelp']}" execute="#this save"/>
<glue:input id="cod" name="code" type="text" label="#{messages['profile.dni']}" value="#{profileHome.instance.code}" required="false" inlinehelp="#{messages['profile.dni.inlinehelp']}" execute="#this save"/>
<glue:input id="eml" name="text" type="email" label="#{messages['common.email']}" value="#{profileHome.instance.email}" required="true" validator="emailValidator" inlinehelp="#{messages['common.email.inlinehelp']}" execute="#this save"/>
<glue:input id="emlSecret" name="emailSecret" type="checkbox" value="#{profileHome.instance.emailSecret}" required="true" inlinehelp="#{messages['common.keepemailsecret']}" execute="#this save"/>
<glue:input id="bio" name="bio" type="textarea" label="#{messages['common.bio']}" value="#{profileHome.instance.bio}" required="false" inlinehelp="#{messages['common.bio.inlinehelp']}" execute="#this save"/>
<!-- Atributos par administrador -->
<!-- Attributos personalizados -->
<c:forEach items="#{profileHome.instance.attributes}" var="a" >
<glue:input id="#{a.structureAttribute.id}" name="#{a.name}" type="#{a.type}" label="#{a.structureAttribute.label}" value="#{a.value}" required="#{a.structureAttribute.required}" inlinehelp="#{a.structureAttribute.helpInline}" execute="#this save" listener="#{account.saveAjax()}" render="#{a.structureAttribute.id} #{a.structureAttribute.render != null ? a.structureAttribute.render : ''}"/>
</c:forEach>
<!-- Atributos relación -->
<glue:group id="#{profileHome.findGroup('spouse').id}" label="#{profileHome.findGroup('spouse').attribute.label}" group="#{profileHome.findGroup('spouse')}" inlinehelp="#{profileHome.findGroup('spouse').attribute.helpInline}"
controller="#{profileHome}"
addAction="addAction"
editListener="editListener">
</glue:group>
</h:form>
</ui:define>
</ui:composition>
</html>
In group.xhtml, the p:commandButton should fire addAction into profileHome bean
#Named
#ViewScoped
public class ProfileHome
....
public void addAction() {
System.out.println("TODO rowAddAction");
}
The button not works!. I try to isolate the button in the page, this works without tags glue:input o glue:group.
Please an advice.
PD. I use primefaces 4.3.1, jsf2, jboss AS7, seam3

Resources