Rich calendar not rendered - jsf

I have a jsf datatable in one of my screen where I have take the date input. Hence I want to replace the input text with rich:calendar. Can someone tell me what all changes have to be done for this?
here is my current code:
<?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:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:head>
<title> Tracker</title>
</h:head>
<h:body>
<h3>list</h3>
<h:form>
<h:dataTable value="#{userMB.entriesRecords}"
var="entryRecord">
<h:column>
<f:facet name="header">Date</f:facet>
<h:inputText value="#{entryRecord.entry.date}"
rendered="#{entryRecord.editable}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:inputText>
<h:outputText value="#{entryRecord.entry.date}"
rendered="#{not entryRecord.editable}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>
</h:column>
</h:dataTable>
<h:commandButton value="Save All Changes" action="#{userMB.saveAll}"></h:commandButton>
</h:form>
</h:body>
</html>

Replace h:inputText with
<rich:calendar enableManualInput="true"
id="entryDate"
datePattern="dd/MM/yyyy"
value="#{entryRecord.entry.date}"
label="Entry Date">
<f:convertDateTime pattern="dd/MM/yyyy" />
</rich:calendar>
It was tested with rich:dataTable and rich:column in RichFaces 4.3.

Related

Column added in the forEach tag are not displayed

I have a ace:dataTable which contains a variable number of columns. For this I use the c:forEach tag. All generated in the c:forEach are not displayed. In the sample, only columnLibelle and columnSum are displayed.
<?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:ice="http://www.icesoft.com/icefaces/component"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
<ui:composition template="/pages/layer/layout.xhtml">
<ui:define name="content">
<ice:form id="myForm">
<h:panelGroup styleClass="table" layout="block">
<ace:dataTable id="myTable"
value="#{myBean.tableElements}"
var="currentElement" rowClasses="oddRow, evenRow" styleClass="tbl"
paginator="false">
<ace:column id="columnLibelle"
headerText="#{msg['common.libelle']}"
sortBy="#{currentElement.libelle}">
<h:outputText value="#{currentElement.libelle}" />
</ace:column>
<ace:column id="columnSum" headerText="#{msg['common.sum']}"
sortBy="#{currentElement.sum}">
<h:outputText value="#{currentElement.sum}">
<f:convertNumber minFractionDigits="0" />
</h:outputText>
</ace:column>
<c:forEach items="#{currentElement.services}" var="currentService">
<ace:column headerText="#{msg[currentElement[currentService.service.label]]}"
sortBy="#{msg[currentElement[currentService.service.label]]}">
<h:outputText value="#{currentElement[currentService.service.value]}">
<f:convertNumber minFractionDigits="0" />
</h:outputText>
</ace:column>
</c:forEach>
</ace:dataTable>
</h:panelGroup>
</ice:form>
</ui:define>
</ui:composition>
</h:body>
</html>

notificationBar doesn't appear

I have the following XHTML page.
The main point is that i want to show a notification when the user click a button. But i don't know why, when i click the button, the notification doesn't appear at all.
<!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:c="http://java.sun.com/jsp/jstl/core"
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>
<f:metadata>
<f:viewParam name="partyname" value="#{personalPageBean.party.name}"/>
</f:metadata>
<h:body>
<p:notificationBar position="top" effect="slide" widgetVar="bar" styleClass="top">
<h:outputText value="What PrimeFaces has so far is just the beginning!" style="font-size:36px;" />
</p:notificationBar>
<ui:include src="../horizontal_menu.xhtml">
</ui:include>
<c:choose>
<c:when test="#{personalPageBean.memberOfParty}">
<p:panel id="panel" header="#{personalPageBean.party.name}" style="margin-bottom:10px;">
<h:panelGrid columns="2">
<h:outputLabel for="symbol" value="Symbol:" />
<h:graphicImage value="#{('../partysymbols/'.concat(personalPageBean.party.symbol))}" width="200" height="171" />
<h:outputLabel for="program" value="Program:" />
<h:outputLabel id="program" value="# {personalPageBean.party.program}" />
<h:link id="partyname" outcome="../memberlist" value="memberlist">
<f:param name="partyname" value="# {personalPageBean.party.name}" />
</h:link>
<p:commandButton value="Show" onclick="bar.show()" type="button" />
</h:panelGrid>
</p:panel>
</c:when>
<c:otherwise>
<h1>You aren't member of a party.</h1>
<h:link outcome="personalpage">my personal page</h:link>
</c:otherwise>
</c:choose>
</h:body>
</html>
So, sorry if i copied the whole page but i really have no idea on where is the error.
thanks to all of you in advance
Try this:
For bar:
<p:notificationBar position="top" effect="slide" styleClass="top" widgetVar="bar">
<h:outputText value="What PrimeFaces has so far is just the beginning!" style="font-size:36px;" />
</p:notificationBar>
And for button:
<p:commandButton value="Show" onclick="PF('bar').show()" type="button" />

No navigation happens when using a p:commandButton

Here is a Facelets file which is used to get first and last name and after that will go to the another Facelets file:
<?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>User Form</title></h:head>
<h:body>
<h:form>
<h:panelGrid columns="2">
<p:graphicImage value="resources/images/image.jpg" width="50%"/>
<p:panelGrid columns="2" width="50%">
<f:facet name="header">
User Form
</f:facet>
<h:outputLabel for="firstname" value="Firstname: *"/>
<p:inputText id="firstname" value="" label="Firstname"/>
<h:outputLabel for="surname" value="Surname: *"/>
<p:inputText id="surname" value="" required="true" label="Surname"/>
<f:facet name="footer">
<p:commandButton type="button" value="Save" icon="ui-icon-check" style="margin:0" action="construction"/>
</f:facet>
</p:panelGrid>
</h:panelGrid>
</h:form>
</h:body>
</html>
I expected to go to the construction.xhtml when I press the "Save" button, but nothing happens. How is this caused and how can I solve it?
when you are using commandButton you must do something like this:
<p:commandButton value="Save" icon="ui-icon-check" style="margin:0" action="#{someBean.navigate}"/>
it means that you must use managed bean
and in your case you must use button instead of commandButton

The Prime Faces out put is not ideal out put

i want to use prime faces to create a panel and my .xhtml is :
<?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:body>
<p:panelGrid columns="2">
<f:facet name="header">
Basic PanelGrid
</f:facet>
<h:outputLabel for="firstname" value="Firstname: *"/>
<p:inputText id="firstname" value="" label="Firstname"/>
<h:outputLabel for="surname" value="Surname: *"/>
<p:inputText id="surname" value="" required="true" label="Surname"/>
<f:facet name="footer">
<p:commandButton type="button" value="Save" icon="ui-icon-check" style="margin:0"/>
</f:facet>
</p:panelGrid>
</h:body>
</html>
the result is :
but the desired output is :
what this problem caused and how can i resolve it?
In order to themes work you'll need to add that to your project. Since you're using normal project(non maven). Download the all-themes jars from here
Add that jar to your build path and try running again.

Richfaces 3.3.3 Collapse all panelBarItem on Page Load

Does anyone know how to not expand any of the panelBarItem's when the page loads? I can't upgrade to Richfaces 4.0 yet and need this fix for 3.3.3. I've tried to use the panelBar's selectedPanel property and set it to an panelBarItem that I don't render but that just renders the first panelBarItem in the list. Any ideas?
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<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:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:genx="http://genx.findmespot.com/facelet-taglib"
xmlns:rich="http://richfaces.org/rich"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:sec="http://sourceforge.net/projects/jsf-comp/acegijsf">
<ui:composition template="#{layoutBean.template}">
<ui:define name="content">
<rich:panelBar height="400" width="650">
<rich:panelBarItem >
<f:facet name="label">
<h:outputFormat escape="false" value="#{bundle['featureConfig.tracking.header.text']}"/>
</f:facet>
panel1
</rich:panelBarItem>
<rich:panelBarItem>
<f:facet name="label">
<h:outputFormat escape="false" value="#{bundle['featureConfig.newMovementAlertSettings.header.text']}"/>
</f:facet>
panel2
</rich:panelBarItem>
<rich:panelBarItem>
<f:facet name="label">
<h:outputFormat escape="false" value="#{bundle['featureConfig.newMovementAlertContacts.header.text']}"/>
</f:facet>
panel2
</rich:panelBarItem>
<rich:panelBarItem>
<f:facet name="label">
<h:outputFormat escape="false" value="#{bundle['featureConfig.dockMode.header.text']}"/>
</f:facet>
panel3
</rich:panelBarItem>
<rich:panelBarItem>
<f:facet name="label">
<h:outputFormat escape="false" value="#{bundle['featureConfig.altitude.header.text']}"/>
</f:facet>
panel4
</rich:panelBarItem>
</rich:panelBar>
</ui:define>
</ui:composition>
</html>

Resources