I have primeface p:panel on jsf file. I apply background color with the following style on the template page (anasayfa.xhtml).
<h:head>
<style type="text/css">
.bos{background-color:red;}
</style>
</h:head>
My Jsf Page with viewscoped backing bean:
<ui:composition template="/anasayfa.xhtml">
<ui:define name="ortaAlan">
...
<p:panel styleClass="bos">
...
</p:panel>
</ui:define>
</ui:composition>
When I load page background color is seen for very shortly, then becomes transparent. CTRL+F5 has the same effect.
What is wrong here?
Thanks for helps in advance
jsf 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:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition template="/anasayfa.xhtml">
<ui:define name="ortaAlan">
<p:panel id="rezerveleriniz">
<h:outputText value="#{rezervasyonBean.bugun.time}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText> : Rezervasyon Saatleri <br/>
<ui:repeat var="r" value="#{rezervasyonBean.kullaniciRezervasyonSaatleri}">
#{r.saatAraligi}<br/>
</ui:repeat>
</p:panel>
<h:form id="aaa">
<p:panel>
<p:panel style="float:left;">
<h:panelGrid columns="1">
<ui:repeat var="rs" value="#{rezervasyonBean.rezervasyonSaatleriListesi}">
**// !!!!!!!!!!!! Problem is here !!!!!!!!**
<p:panel styleClass="#{rezervasyonBean.isRezervasyonOnThisDay(rs) ? 'dolu' : 'bos' }">
#{rs.saatAraligi}
<h:commandButton action="#{rezervasyonBean.sec(rs,'1')}" value="+" update=":rezerveleriniz" disabled="#{rezervasyonBean.isRezervasyonOnThisDay(rs)}" />
</p:panel>
</ui:repeat>
</h:panelGrid>
<h:commandButton action="#{rezervasyonBean.kaydet()}" value="Kaydet" />
</p:panel>
<div style="clear:both;"></div>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</html>
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:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Görev Takip Sistemi</title>
<style type="text/css">
.ui-widget,.ui-widget .ui-widget {
font-size: 12px !important;
font-family:Arial;
}
.bos{
background-color:red;
}
.dolu{
background-color:yellow;
}
#topPanel {z-index:2 !important; }
#topPanel div{overflow:visible;}
.colStyle_panelGridForGorev{
width:225px;
}
.colStyle_panelGridForProfil{
width:100px;
}
</style>
</h:head>
<body>
<p:growl for="growlForAnasayfa" showDetail="true" life="3000" autoUpdate="true"/>
<h:form>
<p:idleMonitor timeout="900000">
<p:ajax event="idle" listener="#{anasayfaBean.indirectLogout}"/>
</p:idleMonitor>
</h:form>
<p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();" />
<p:dialog modal="true" widgetVar="statusDialog" header="Status"
draggable="false" closable="false">
<p:graphicImage value="/images/statusBar.gif" />
</p:dialog>
<p:layout fullPage="true">
<p:layoutUnit position="north" size="50" id="topPanel" style="border:0px">
<h:form id="formAnaSayfaToolbar">
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton type="submit" value="#{anasayfaBean.kullanici.kullaniciAdi} #{anasayfaBean.kullanici.kullaniciSoyadi}"
style="margin-left:200px;" action="/profil.xhtml?faces-redirect=true" ajax="false"/>
<p:commandButton type="submit" value="Gruplarım"
action="/kullanici/gruplarim.xhtml?faces-redirect=true" ajax="false" rendered="#{!anasayfaBean.daireBaskani}"/>
<p:commandButton type="submit" value="Görevlerim"
action="/gorevListele.xhtml?faces-redirect=true" ajax="false" rendered="#{!anasayfaBean.daireBaskani}"/>
<p:commandButton type="submit" value="Kullanıcı İşlemleri"
action="/daireBaskani/kullanici.xhtml?faces-redirect=true" ajax="false" rendered="#{anasayfaBean.daireBaskani}"/>
<p:commandButton type="submit" value="Grup İşlemleri"
action="/daireBaskani/grup.xhtml?faces-redirect=true" ajax="false" rendered="#{anasayfaBean.daireBaskani}"/>
<p:menuButton value="Görev İşlemleri" rendered="#{anasayfaBean.daireBaskani}">
<p:menuitem value="Yeni Görev Ekle" url="/daireBaskani/gorevEkle.btk" />
<p:menuitem value="Gorevleri Listele" url="/gorevListele.btk" />
</p:menuButton>
<p:menuButton value="Admin Paneli" rendered="#{anasayfaBean.admin}">
<p:menuitem value="Birim İşlemleri" url="/admin/birim.btk" />
<p:menuitem value="Ünvan İşlemleri" url="/admin/unvan.btk" />
</p:menuButton>
</p:toolbarGroup>
<p:toolbarGroup align="right">
<p:commandButton type="submit" value="Çıkış" icon="ui-icon-close"
action="#{anasayfaBean.logout}" ajax="false" style="margin-right:200px;"/>
</p:toolbarGroup>
</p:toolbar>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center">
<ui:insert name="ortaAlan">
<h:outputText value="Yukarıdaki menüden yapmak istediğiniz işlemi seçiniz." />
</ui:insert>
</p:layoutUnit>
<p:layoutUnit position="south" size="30" resizable="true" style="border-width:0px;">
<h:form style="text-align:center; font-size:13px;">
<h:outputText value="Bilişim Sistemleri Dairesi © 2012" />
</h:form>
</p:layoutUnit>
<p:layoutUnit position="east" size="200" id="eastPanel" style="border:0px">
</p:layoutUnit>
<p:layoutUnit position="west" size="200" id="westPanel" style="border:0px">
</p:layoutUnit>
</p:layout>
</body>
</html>
Related
I have used p:layoutUnit to set up a menu on the left and a main page on the right. This works ok until I add a p:dialog. Now when I select the stocks menu item the whole page refreshes instead of just the main page. I realise p:dialog applies to the whole page since it is modal, so I wondered what is the correct way to implement this to avoid a whole page refresh?
Here is my layout:
Index2.xhtml:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:head>
<title>Index2</title>
</h:head>
<h:body>
<p:layout style="min-width:400px;min-height:700px;">
<p:layoutUnit position="west" resizable="false" size="300" minSize="40" maxSize="200">
<h:form>
<p:menu>
<p:submenu label="Menu">
<p:menuitem value="Stocks" outcome="stocks" />
<p:menuitem value="Portfolio" outcome="portfolio"/>
</p:submenu>
</p:menu>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center">
<h3 style="margin-top:0">Plain Menu</h3>
<ui:insert name="source" />
</p:layoutUnit>
</p:layout>
</h:body>
</html>
Stocks.xhtml:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
template="index2.xhtml">
<ui:define name="source">
<script type="text/javascript">
function handleMessage(data)
{
if(data == 'price')
{
updateWidget();
console.log("stocks: data is price");
}
}
function onError(){
console.log("on error");
}
function onStart(){
console.log("on start");
}
function onComplete(){
console.log("on complete");
}
function onSuccess(){
console.log("on success");
}
</script>
<h:form id="form">
<p:dataGrid id="prices" var="orderBooks" value="#{stocksView.latestPricesResults}" columns="3" rows="12">
<f:facet name="header">
WST 100
</f:facet>
<p:column>
<p:panel header="#{orderBooks.bidOrderId.member.memberId}">
<h:panelGrid columns="1">
<h:outputText value="#{orderBooks.price}" />
<h:outputText value="#{orderBooks.bidOrderId.member.party}" />
<h:outputText value="#{orderBooks.lastUpdate}" />
<p:commandLink update=":form:buyDetail" oncomplete="PF('buyDialog').show()" title="View Detail">
<h:outputText value="Buy"/>
<f:setPropertyActionListener value="#{orderBooks}" target="#{stocksView.selectedStock}" />
</p:commandLink>
</h:panelGrid>
</p:panel>
</p:column>
</p:dataGrid>
<p:dialog header="Buy Shares" widgetVar="buyDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false" appendTo="#(body)">
<p:outputPanel id="buyDetail" style="text-align:center;">
<p:panelGrid columns="2" columnClasses="label,value">
<h:outputText value="Member" />
<h:outputText value="#{stocksView.selectedStock.bidOrderId.member.memberId}" />
</p:panelGrid>
</p:outputPanel>
</p:dialog>
<p:remoteCommand name="updateWidget"
actionListener="#{stocksView.findLatestPrices}"
autoRun="true"
update="prices"
onstart="onStart()"
oncomplete="onComplete()"
onsuccess="onSuccess()"
onerror="onError()">
</p:remoteCommand>
</h:form>
<p:socket onMessage="handleMessage" channel="/notify" />
</ui:define>
</ui:composition>
I have a layout with layoutUnit west and layoutUnit center, west side have a menu that calls another pages that render in the center side, the problem is that all layout is refreshed(west and center side) when another page rendered in center. I have follow code:
<p:layout style="width: 100%; height: 450px" >
<p:layoutUnit position="west" size="230" collapsible="false" >
<h:form>
<p:menu style="font-size: 14px; width: 95%;height: 420px " >
<p:submenu label="MENU">
<p:menuitem value="Students" icon="ui-icon-arrowthick-1-n" url="pantallas/students.xhtml" />
<p:menuitem value="Teachers" icon="ui-icon-refresh" url="pantallas/teacher.xhtml" />
</p:submenu>
</p:menu>
</h:form>
</p:layoutUnit>
<p:layoutUnit id="layout1" position="center" >
<h:form>
<ui:insert name="content" ></ui:insert>
</h:form>
</p:layoutUnit>
</p:layout>
And student.xhtml like:
<ui:composition template="../administracion.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<ui:define name="content">
<h:head>
<h:outputStylesheet library="css" name="styles2.css"/>
<title>Facelet Title</title>
</h:head>
<h:body>
<p:panel header="Student" style="width: 90%; margin: auto auto">
<h:form id="forma1">
<p:panel style="text-align: center">
<p:inputText placeholder="Students" value="#{datosCT.cct}"/>
<p:commandButton value="buscar" actionListener="#{controlCTAlumnos.traeInfo()}" update="panel1">
<f:ajax listener="#{controlCTAlumnos.mostrarPanel(e)}" render="panel1" />
</p:commandButton>
</p:panel>
</h:form>
</p:panel>
</h:body>
</ui:define>
I saw and tried some many ways to refresh only layoutUnit center but doesn´t work in this case.
can someone help me??
thanks in advance.
You can do the partial update on form component inside your layout unit from your content page.
<p:layoutUnit id="layout1" position="center" >
<h:form id="form>
<ui:insert name="content" ></ui:insert>
</h:form>
</p:layoutUnit>
student.xhtml
<p:commandButton value="buscar" update=":form"/>
I've got a project with JSF 2.1.28 and PrimeFaces 4.0. I've got a problem with my editor controller template.
My page is this:
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<p:panel header="#{locCommon.report} #{locCommon.editor}">
<h:form id="editForm">
<h:panelGrid columns="2">
<p:outputLabel value="#{locCommon.name}" />
<p:inputText value="#{reportBean.businessItem.name}" />
<p:outputLabel value="HQL" />
<p:selectBooleanCheckbox value="#{reportBean.businessItem.hql}" />
<p:outputLabel value="SQL" />
<p:inputTextarea value="#{reportBean.businessItem.sql}" />
</h:panelGrid>
<p:commandButton value="#{locCommon.tryQuery}" action="#{reportBean.tryQuery()}" process="#form"
update=":resultPanel" styleClass="button" />
</h:form>
</p:panel>
<p:panel id="resultPanel" header="#{locCommon.result}">
<ui:decorate template="/components/reportTable.xhtml">
<ui:param name="lstValues" value="#{reportBean.businessItem.lstResult}" />
<ui:param name="model" value="#{reportBean.businessItem.lstReportFields}" />
</ui:decorate>
</p:panel>
<p:panel>
<h:form>
<ui:decorate template="/components/editorController.xhtml" >
<ui:param name="bean" value="#{reportBean}" />
<ui:define name="saveButtonAttributes">
<f:attribute name="process" value=":editForm"/>
</ui:define>
</ui:decorate>
</h:form>
</p:panel>
</ui:composition>
On the last panel, there is an another template, which I want to set process attribute of a commandButton on this template:
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<table style="width: 100%;">
<tr>
<td align="left">
<p:commandButton value="#{locCommon.save}" styleClass="button" action="#{bean.save(true)}" process="#form">
<ui:insert name="saveButtonAttributes"/>
</p:commandButton>
</td>
<td align="right">
<p:commandButton value="#{locCommon.cancel}" styleClass="button" action="#{bean.cancel()}" process="#this" />
</td>
</tr>
</table>
</ui:composition>
The code above sadly not set this process attribute to ':editForm' which is the goal. My question is, how can I do this?
We are migrating our App from glassfish to wildfly. However, the primefaces theme no longer loads. I am attaching the pages which are loaded .
Firebug console shows an error - ReferenceError: $ is not defined
Index.xhtml
`
<?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: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"
>
<h:head>
<link rel="shortcut icon"
href="http://www.hs-furtwangen.de/fileadmin/templates/favicon.ico"
type="image/x-ico; charset=binary" />
<f:facet name="first">
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type" />
<title>#{messages.finquasCompleteName}</title>
</f:facet>
</h:head>
<h:body>
<ui:composition template="./mainTemplate.xhtml">
<ui:define name="NonServiceView">
<h:form>
<p:growl autoUpdate="true" />
<div class="activitySream">
<div class="activityStreamHeader">
#{messages.activityStream}
</div>
<p:outputPanel deferred="true">
<p:dataList id="id_list_activity_stream"
value="#{activityStreamController.logEntries}" var="logEntry"
type="none" emptyMessage="#{messages.noActivitiesFound}">
<div class="activityDescriptionArea">
<div class="activityIconArea">
<h:outputText value="#{activityStreamController.getActionSpecificIconCode(logEntry.changeType)}"
escape="false" />
</div>
<div class="activityDescription">
<h:outputText value="#{logEntry.creator.name}" styleClass="boldLabel" />
<h:outputText value="#{activityStreamController.getActivityTextFirstPartForLogEntry(logEntry)}" />
<h:commandLink styleClass="boldLabel"
action="#{activityStreamController.navigateToEntity(logEntry.abstractEntity)}">
#{activityStreamController.getEnitityText(logEntry.abstractEntity)}
</h:commandLink>
<h:outputText value="#{activityStreamController.getChangeLogLabelOfLogEntry(logEntry)}." />
<div class="activityDate">
<h:outputText value="#{logEntry.changeDate}">
<f:convertDateTime pattern="dd.MM.yyyy HH:mm:ss" timeZone="Europe/Berlin" />
</h:outputText>
</div>
</div>
</div>
</p:dataList>
<p:commandButton value="#{messages.showMore}" action="#{activityStreamController.showMore()}"
update="id_list_activity_stream"
rendered="#{not empty activityStreamController.logEntries}"
styleClass="plainText greenButton showMoreActivitiesButton"/>
</p:outputPanel>
</div>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>`
mainTemplate.xhtml
`
<?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: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"
>
<h:body>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="./headerFooterLoggedInPagesTemplate.xhtml">
<ui:define name="leftHeaderUnit">
<p:commandButton
id="id_btn_home"
action="#{navigationController.navigateHome()}"
value="#{iconSetController.home}"
escape="false" title="#{messages.home}"
update=":structureTreeForm" ajax="false" />
</ui:define>
<ui:define name="rightHeaderUnit">
<p:commandButton id="id_btn_main_user_profile"
action="userProfile"
title="#{messages.myProfile}"
value="#{iconSetController.user}"
ajax="false"
escape="false" />
<p:commandButton id="id_btn_main_help"
action="help"
title="#{messages.help}"
value="#{iconSetController.help}"
escape="false" />
<p:commandButton id="id_btn_main_logout"
title="#{messages.logout}"
value="#{iconSetController.logout}"
escape="false"
action="#{navigationController.logout()}" />
</ui:define>
<!--The empty header field is a necessary in order to display the collapsible button-->
<ui:define name="navigationArea">
<p:layoutUnit position="west"
collapsible="true"
header=""
effect="none"
resizable="true" id="id_lu_navigationBarLeft" size="320" minSize="300">
<p:tabView id="id_tabView_navigationBar"
dynamic="true"
activeIndex="#{navigationController.activeNavigationBarTabIndex}"
styleClass="finquasTabs">
<p:ajax event="tabChange" listener="#{navigationController.onNavigationBarTabChange}" />
<p:tab title="#{messages.myServicesTab}">
<p:panel rendered="#{not empty navigationController.administrationServicesOfCurrentUser}" header="#{messages.myAdministrationServices}">
<h:form id="myAdministrationServicesForm">
<p:dataList id="id_list_my_administration_services"
value="#{navigationController.administrationServicesOfCurrentUser}"
var="service"
rendered="#{not empty navigationController.administrationServicesOfCurrentUser}">
<p:column>
<h:commandLink
action="#{navigationController.viewServiceViaObject(service)}">
#{service.name}
</h:commandLink>
</p:column>
</p:dataList>
</h:form>
</p:panel>
<p:panel rendered="#{not empty navigationController.educationalServicesOfCurrentUser}" header="#{messages.myEducationalServices}">
<h:form id="myEducationalServicesForm">
<p:dataList id="id_list_my_product_services"
value="#{navigationController.educationalServicesOfCurrentUser}"
var="service"
rendered="#{not empty navigationController.educationalServicesOfCurrentUser}">
<p:column>
<h:commandLink
action="#{navigationController.viewServiceViaObject(service)}">
<h:outputText value="#{service.name}" />
<h:outputText value=" #{messages[service.getDegree().getAbbreviation()]}#{messages[service.getDegreeType().getAbbreviation()]}" rendered="#{navigationController.isDegreeProgram(service)}"/>
<h:outputText value=" #{navigationController.getStateOfService(service)}" rendered="#{navigationController.isServiceDegreeProgramOrStudyModule(service)}"/>
</h:commandLink>
</p:column>
</p:dataList>
</h:form>
</p:panel>
<p:panel rendered="#{not empty navigationController.peerReviewsOfCurrentUser}" header="#{messages.myPeerReviews}">
<h:form id="myPeerReviewsForm">
<p:dataList id="id_list_my_review_services"
value="#{navigationController.peerReviewsOfCurrentUser}"
var="service"
rendered="#{not empty navigationController.peerReviewsOfCurrentUser}">
<p:column>
<h:commandLink
action="#{navigationController.viewServiceViaObject(service)}">
#{service.name} (#{messages[service.state.class.name]})
</h:commandLink>
</p:column>
</p:dataList>
</h:form>
</p:panel>
<p:panel rendered="#{not empty navigationController.qualityReportServicesOfCurrentUser}" header="#{messages.myQualityReportServices}">
<h:form id="myQualityReportServicesForm">
<p:tree id="id_list_my_quality_report_services"
value="#{navigationController.qualityReportServiceRoot}"
var="serviceNode"
dynamic="true"
rendered="#{not empty navigationController.qualityReportServicesOfCurrentUser}">
<p:ajax event="expand" listener="#{navigationController.onNodeExpandQualityReportGraph}" />
<p:ajax event="collapse" listener="#{navigationController.onNodeCollapse}" />
<p:treeNode>
<h:commandLink
action="#{navigationController.viewServiceViaObject(serviceNode)}">
<span title="#{messages.qualityReportFinished}"><h:panelGroup layout="block" class="greenCircle" rendered="#{serviceNode.state.position == 3}"/> </span>
<span title="#{messages.qualityReportWaitingForStatement}"><h:panelGroup layout="block" class="yellowCircle" rendered="#{serviceNode.state.position == 2}"/></span>
<span title="#{messages.qualityReportWaitingForStatementStudyDean}"><h:panelGroup layout="block" class="redCircle" rendered="#{serviceNode.state.position == 1}"/></span>
#{serviceNode.simpleName}
</h:commandLink>
</p:treeNode>
</p:tree>
</h:form>
</p:panel>
</p:tab>
<p:tab title="#{messages.serviceStructureTab}">
<p:panel header="#{messages.search}" styleClass="finquasinput">
<h:form id="id_form_main_search">
<p:autoComplete id="id_input_main_search"
forceSelection="true"
placeholder="#{messages.autoCompleteHint}"
value="#{navigationController.serviceName}"
effect="fade"
required="true"
requiredMessage="#{messages.noServiceFound}"
styleClass="autocompleteService"
completeMethod="#{navigationController.completeService}" />
<p:commandButton id="id_btn_main_search"
value="#{iconSetController.search}" escape="false"
action="#{navigationController.viewServiceViaAutoComplete}"
ajax="false" />
</h:form>
</p:panel>
<p:panel header="#{messages.structure}">
<h:form id="structureTreeForm">
<p:tree value="#{navigationController.serviceRoot}"
dynamic="true"
var="serviceNode"
styleClass="finquastree"
animate="true">
<p:ajax event="expand" listener="#{navigationController.onNodeExpandEducationalServiceGraph}" />
<p:ajax event="collapse" listener="#{navigationController.onNodeCollapse}" />
<p:treeNode>
<h:commandLink
action="#{navigationController.viewServiceViaObject(serviceNode)}">
<h:outputText value="#{serviceNode.name} #{messages[serviceNode.getDegree().getAbbreviation()]}#{messages[serviceNode.getDegreeType().getAbbreviation()]}" rendered="#{serviceNode['class'].simpleName == 'DegreeProgram'}"/>
<h:outputText value="#{serviceNode.name}" rendered="#{serviceNode['class'].simpleName != 'DegreeProgram'}"/>
</h:commandLink>
</p:treeNode>
</p:tree>
</h:form>
</p:panel>
</p:tab>
</p:tabView>
</p:layoutUnit>
</ui:define>
</ui:composition>
</ui:composition>
</h:body>
</html>`
headerFooterTemplate.xhtml
`
<?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: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"
>
<h:body>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">
<ui:insert name="loggedInCheck" />
<f:facet name="last">
<h:outputStylesheet library="css" name="default.css" />
<h:outputScript library="scripts" name="primefacesLocalization.js"
target="head" />
</f:facet>
<p:layout fullPage="true">
<p:layoutUnit id="id_lu_headerUnit" position="north">
<h:form id="id_form_headerForm">
<p:toolbar styleClass="finquasheader">
<p:toolbarGroup styleClass="headerBar">
<ui:insert name="leftHeaderUnit" />
</p:toolbarGroup>
<p:toolbarGroup align="right" styleClass="headerBar">
<ui:insert name="rightHeaderUnit" />
</p:toolbarGroup>
</p:toolbar>
</h:form>
</p:layoutUnit>
<ui:insert name="navigationArea" />
<p:layoutUnit id="id_lu_centerUnit" position="center">
<div id="contentArea">
<div class="nonServiceView">
<ui:insert name="NonServiceView" />
</div>
<ui:insert name="ServiceView" />
</div>
</p:layoutUnit>
<p:layoutUnit position="south" id="footerUnit">
<h:form>
<p:toolbar styleClass="finquasfooter">
<p:toolbarGroup>
<ui:insert name="leftFooterContent" />
</p:toolbarGroup>
<p:toolbarGroup align="right" styleClass="footerToolbar">
#{messages.finquasCompleteName}
</p:toolbarGroup>
</p:toolbar>
</h:form>
</p:layoutUnit>
</p:layout>
</f:view>
</ui:composition>
</h:body>
</html>`
headerFooterLoggedInPagesTemplate.xhtml
` <?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: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"
>
<h:body>
<ui:composition template="./headerFooterTemplate.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
<ui:param name="currentUser" value="#{sessionController.currentUser}" />
<ui:define name="loggedInCheck">
<c:if test="#{!sessionController.loggedIn}">
<meta HTTP-EQUIV="REFRESH"
content="0;URL='#{navigationController.serverUrl}'" />
</c:if>
</ui:define>
<ui:define name="leftFooterContent">
#{currentUser.firstName} #{currentUser.lastName}
<script>
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-49887094-1', 'hs-furtwangen.de');
ga('send', 'pageview');
</script>
</ui:define>
</ui:composition>
</h:body>
</html>`
I got the error. All my template pages were using composition and each had its own head tag. While this worked with glassfish, wildfly did not allow it.
Removing head from all but the base template and making the base template not a composition solved this
I'm new to primefaces JSF, I have three pages called Template page, Master page with dialog option and bean attached with dialog option but when I click command button in dialog box the bean method not calling. please help us if anybody knows about this issue. Thanks
MasterTemplate.xhtml
<?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: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">
<f:view contentType="text/html">
<h:head>
<f:facet name="first">
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
<title><h:outputText value="#{prop.application_name}"/></title>
</f:facet>
<link type="text/css" rel="stylesheet" href="${facesContext.externalContext.requestContextPath}/css/default.css"/>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit header="#{prop.application_name}" position="north" size="240" resizable="false" closable="false" collapsible="true">
<h:form id="toolBarForm">
<p:toolbar>
<p:toolbarGroup align="right">
<h:outputText value="Welcome :#{sessionScope.userName}"/>
<p:separator />
<p:commandButton action="#{userLogout.logout}" value="#{prop.Template_button}" ajax="false" />
<p:menuButton value="Quick Access">
<p:menuitem action="ChangePassword" icon="ui-icon-key" value="Change password"/>
<p:menuitem icon="ui-icon-person" value="View Profile"/>
<p:menuitem action="#{userLogout.logout}" icon="ui-icon-locked" value="Logout"/>
</p:menuButton>
</p:toolbarGroup>
</p:toolbar>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="west" size="300" header="#{prop.Template_Menu_Header}" collapsible="true">
<h:form id="f2">
<p:tree value="#{menuBean.root}" var="node" id="tree" highlight="true "
selection="#{menuBean.selectedNode}"
selectionMode="single" >
<p:ajax event="select" listener="#{menuBean.onNodeSelect}" update=":mainArea"/>
<p:treeNode id="treeNode" >
<h:outputText value="#{node}"/>
</p:treeNode>
</p:tree>
</h:form>
</p:layoutUnit>
<ui:insert name="MainBody" />
<p:layoutUnit header="#{prop.application_footer}" position="south" closable="false" collapsible="false">
</p:layoutUnit>
</p:layout>
</h:body>
</f:view>
</html>
default.xhtml
<ui:composition template="templates/MasterTemplate.xhtml"
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">
<ui:define name="MainBody">
<p:layoutUnit position="center">
<h:panelGroup id="mainArea">
<ui:include src="#{menuBean.renderPage}"/>
</h:panelGroup>
</p:layoutUnit>
</ui:define>
</ui:composition>
ThirdPage.xhtml
<?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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title> Title</title>
</h:head>
<h:body>
<h:form id="test">
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton value="New User" onclick="newUserDialog.show()"/>
<p:commandButton action="#{lbc.login}" process="#test" value="View" >
</p:commandButton>
<p:commandButton type="button" value="Edit" title="Update" icon="ui-icon-pencil">
</p:commandButton>
<p:separator />
<p:commandButton type="button" value="Delete" title="Delete" icon="ui-icon-trash"/>
</p:toolbarGroup>
<p:toolbarGroup align="right">
<p:commandButton type="button" value="Search" icon="ui-icon-search"/>
</p:toolbarGroup>
</p:toolbar>
</h:form>
<h:form prependId="false">
<p:dialog header="Create New User" widgetVar="newUserDialog" resizable="true" id="newUserDlg" >
<h:panelGrid id="region" columns="2" cellpadding="5">
<h:outputLabel for="username" value="Username:" />
<p:inputText value="#{lbc.username}"
id="username" required="true" label="username" />
<h:outputLabel for="password" value="Password:" />
<p:password value="#{lbc.password}"
id="password" required="true" label="password" />
<f:facet name="footer">
<p:commandButton partialSubmit="true" action="#{lbc.login}" value="add">
</p:commandButton>
</f:facet>
</h:panelGrid>
</p:dialog>
</h:form>
</h:body>
</html>
package mod.om.login;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.event.ActionEvent;
import javax.faces.event.AjaxBehaviorEvent;
#ManagedBean(name = "lbc")
#RequestScoped
public class LoginBean implements Serializable{
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public void login() {
System.out.println("Called");
}
}
I had the same problem; but in my case, it was when I migrated primefaces from version 5.0 to 6.2.
I solved it removing the <f:facet name="footer"... or wrapping with <h:panelGrid ... the <p:commandButton ... like the following example.
<f:facet name="footer">
<h:panelGrid columns="1" >
<p:commandButton partialSubmit="true" action="#{lbc.login}" value="add">
</p:commandButton>
</h:panelGrid>
</f:facet>