How to change activeindex in TabMenu - primefaces

I have a question concerning the component Tabmenu of primefacess and specifically the attribute active index, the index of the page selected. I would like to change it according to the page chosen but it is always fixed on the front page! This is my code:
<ui:composition 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">
<p:tabMenu rendered="true" widgetVar="index">
<p:menuitem value="Home" url="Menu.jsf" icon="ui-icon-star"/>
<p:menuitem value="Fabricants" url="/pagess/pagesFabricant/Fabricant.jsf" icon="ui-icon-wrench" oncomplete="index.select(1)"/>
<p:menuitem value="Composants" url="/pagess/pagesComposant/Composant.jsf" icon="ui-icon-search" oncomplete="index.select(2)"/>
<p:menuitem value="Dossier d'equivalence" url="DEQ.jsf" icon="ui-icon-document" oncomplete="index.select(3)"/>
</p:tabMenu>
</ui:composition>
it doesn't work
thx for your cooepration ,but its not working
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">
<p:tabMenu activeIndex="0" >
<p:menuitem value="Home" url="Menu.jsf" icon="ui-icon-star" update="#all"/>
<p:menuitem value="Fabricants" url="/pagess/pagesFabricant/Fabricant.jsf" icon="ui-icon-wrench" update="#all" />
<p:menuitem value="Composants" url="/pagess/pagesComposant/Composant.jsf" icon="ui-icon-search" update="#all"/>
<p:menuitem value="Dossier d'equivalence" url="DEQ.jsf" icon="ui-icon-document" update="#all"/>
</p:tabMenu>
</ui:composition>

The activeIndex attribute on tabmenu sets the tab on that index active. If you click around the tabs at the primefaces tabmenu showcase and keep looking at the source examples, you'll see that this is exactly what is happening. They set different activeIndex on each page.

I have found a solution in the PrimeFaces showcase. You can add a request parameter to the menuitem and append this parameter to your url. So no backing bean is needed to keep the active index:
<p:tabMenu activeIndex="#{param.i}">
<p:menuitem value="Home" icon="ui-icon-home" url="page1.xhtml?i=0">
<f:param name="i" value="0" />
</p:menuitem>
<p:menuitem value="Search" icon="ui-icon-search" url="page2.xhtml?i=1">
<f:param name="i" value="1" />
</p:menuitem>
...
</p:tabMenu>

Create template.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition
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:p="http://primefaces.org/ui">
<p:tabMenu activeIndex="#{activeIndex}">
<p:menuitem
value="tab1"
url="/tab1.jsf">
</p:menuitem>
<p:menuitem
value="tab2"
url="/tab2.jsf">
</p:menuitem>
</p:tabMenu>
<h:panelGroup id="mainPanel" style="width:100%">
<ui:insert name="page">Page Content</ui:insert>
</h:panelGroup>
</ui:composition>
Set Parameter in tab pages
<ui:composition 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:p="http://primefaces.org/ui"
template="template.xhtml">
<ui:param name="activeIndex" value="1" />
<ui:define name="page">
tab1 content
</ui:define>
</ui:composition>

Consider you have two .jsf files namely Menu.jsf and Fabricant.jsf
Put following snippet code in Menu.jsf that will select 0th Index from menuItem
<p:tabMenu activeIndex="0" >
<p:menuitem value="Home" url="Menu.jsf" icon="ui-icon-star"/>
<p:menuitem value="Fabricants" url="/pagess/pagesFabricant/Fabricant.jsf" icon="ui-icon-wrench"/>
</p:tabMenu>
Put following snippet code in Fabricant.jsf that will select 1st Index from menuItem
<p:tabMenu activeIndex="1" >
<p:menuitem value="Home" url="Menu.jsf" icon="ui-icon-star"/>
<p:menuitem value="Fabricants" url="/pagess/pagesFabricant/Fabricant.jsf" icon="ui-icon-wrench"/>
</p:tabMenu>
For more information click here

<p:tabMenu rendered="true" widgetVar="#{bean.index}">
<p:menuitem value="Home" action="#{bean.redirect(1)}"/>
<p:menuitem value="Fabricants" action="#{baen.redirect(2)}"/>
</p:tabMenu>
on my bean {
int index;
getter and setter;
public String redirect(int a){
if (a==1){
index=1;
return "Home" or // "/home.jsf
}
else if (a==2){
index =2;
return "Fabricant";
}
}
it works fine thx all for your cooperation :)

I had the same issue while using the tab menu as a component that other pages <ui:include>ed. I used the suggestions above for the following fix:
The component (let's call it myMenu.xhtml):
<p:tabMenu id="myMenuBar" activeIndex="#{parentIndex}">
<p:menuitem value="Page One" action="#{PageOneBacker.mainNavigation}" />
<p:menuitem value="Page Two" action="#{PageTwoBacker.mainNavigation}" />
<p:menuitem value="Page Three" action="#{PageThreeBacker.mainNavigation}" />
</p:tabMenu>
Now in each page, I have:
<ui:include src="../myMenu.xhtml">
<ui:param name="parentIndex" value="XXX" />
</ui:include>
Where XXX is the numeric index of that page in the menu, starting from 0. I'm not 100% happy having to "hard-code" these index'es like this, but it is a solution.

Related

JSF 2 and Primefaces attribute Ajax=false

I have a form that has a commandlink that opens a modal dialog, the dialog has an inputtext and a button saved, when I enter a value in the inputtext, this value has to be copied to another inputtext in the first form, but the attribute update doesn't update the inputtext in the first form, I have to put attribute ajax="false" in the button save of the dialog for that reload the page, so the value in the inputtext of the dialog is copied to the inputtext of the first form. I want to know if there is another way to update this value without the attribute ajax="false" and doesn't reload the page
create_store.xhtml
<ui:composition
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:panelGrid columns="3" width="100%" border="0" columnClasses="colC1,colC2">
<h:outputText value="Code: " style="margin-right:20px;"/>
<p:inputText id="idCodProvider" value="#{storeBean.au.code}" size="84"/>
<h:outputText value="Name: " style="margin-right:20px;"/>
<p:inputText id="idName" value="#{storeBean.au.name}" size="84"/>
<p:commandLink id="idAdressLink" style="margin-right:20px;" actionListener="#{storeBean.selectAdress}"
update=":idFormAdress:idPgADressStore" >
<h:outputText value="Adress:" />
</p:commandLink>
<p:inputText id="idAdressStore" label="Adress" value="#{storeBean.au.adressStore}" size="84"/>
<h:outputText value="   " />
</h:panelGrid>
dialog_adress.xhtml
<ui:composition 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:panelGrid id="idPgAdressStore" columns="2" columnClasses="col1,col2">
<h:outputLabel for="idAdress" value="Adress: " />
<p:inputText id="idAdress" label="Adress" size="40" value="#{adressBean.au.strAdress}"/>
<f:facet name="footer">
<h:panelGrid width="100%" columns="2" style="text-align:center">
<p:commandButton id="idBtSaveDir" value="Save" actionListener="#{storeBean.saveAdress}"
update=":idFormAdress,:idFormStore" onComplete="PF('dlgDirStore').hide()"/>
<p:commandButton id="idBtCancelDir" value="Cancel" type="button" onclick="PF('dlgDirStore').hide()"/>
</h:panelGrid>
</f:facet>
</h:panelGrid>

p:commandButton action has not being called in dynamic pages

I have an application that has a layout with left and center layout units (demoLayout.xhtml). On main page (main.xhtml) i have p:tree on left layout unit (demoTree.xhtml) and three different forms on center layout unit (first.xhtml, second.xhtml, third.xhtml). Center forms switches using tree node clicks. My default center form is first.xhtml and when i do not put p:commandButton on first.xhtml command buttons on second.xhtml and on third.xhtml actions has not being called. When i put p:commandButton on first.xhtml the other command buttons works, but i do not want to put p:commandButton on first.xhtml. How can i do?
demoLayout.xhtml
<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 id="mainPanel" encoding="UTF-8" contentType="text/html">
<h:head>
<f:facet name="first">
<meta http-equiv="X-UA-Compatible" content="EmulateIE8" />
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type" />
<title>#{title}</title>
</f:facet>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit id="left" position="west" size="300" resizable="true" closable="true" collapsible="true" header="Quick Links" visible="true" minSize="200">
<div id="west">
<ui:insert name="west">
Default West Content
</ui:insert>
</div>
</p:layoutUnit>
<p:layoutUnit id="center" position="center">
<div id="centerDiv">
<ui:insert name="center">
Default Center Content
</ui:insert>
</div>
</p:layoutUnit>
</p:layout>
</h:body>
</f:view>
</html>
main.xhtml
<ui:composition template="demoLayout.xhtml"
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">
<ui:param name="title" value="demo" />
<ui:define name="west">
<ui:include src="demoTree.xhtml" />
</ui:define>
<ui:define name="center">
<ui:include src="#{demo3MBean.activePanel}" />
</ui:define>
</ui:composition>
demoTree.xhtml
<ui:composition 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:form id="treeForm">
<p:growl id="messages" showDetail="true" sticky="false" />
<p:tree value="#{demoTreeBean.root}" var="node" id="tree" animate="true" style="width:350px;height:720px" dynamic="true" cache="false"
selectionMode="single">
<p:treeNode type="First">
<h:outputText value="#{node}" id="lblNode1" />
</p:treeNode>
<p:treeNode type="Second">
<h:outputText value="#{node}" id="lblNode2" />
</p:treeNode>
<p:treeNode type="Third">
<h:outputText value="#{node}" id="lblNode3" />
</p:treeNode>
<p:ajax event="select" update=":rightForm" listener="#{demo3MBean.onNodeSelect}" />
</p:tree>
<p:blockUI block=":center" trigger="tree">
LOADING<br />
<p:graphicImage value="/images/ajax-loader.gif" />
</p:blockUI>
</h:form>
</ui:composition>
first.xhtml
<ui:composition 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:form id="rightForm">
<p:growl id="messages" showDetail="true" sticky="false" />
<br></br>
<p:fieldset id="resourceList" legend="1 nolu grup">
<h:outputText value="1 Nolu XHTML" />
<br />
<ui:remove>
<p:commandButton id="buton" value="Print Me 1" actionListener="#{demo3MBean.printMe1}" />
</ui:remove>
</p:fieldset>
</h:form>
</ui:composition>
second.xhtml
<ui:composition 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:form id="rightForm">
<p:growl id="messages" showDetail="true" sticky="false" />
<br></br>
<p:fieldset id="resourceList" legend="2 nolu grup">
<h:outputText value="2 Nolu XHTML" />
<br />
<p:commandButton id="buton" value="Print Me 2" actionListener="#{demo3MBean.printMe2}" />
</p:fieldset>
</h:form>
</ui:composition>
third.xhtml
<ui:composition 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:form id="rightForm">
<p:growl id="messages" showDetail="true" sticky="false" />
<br></br>
<p:fieldset id="resourceList" legend="3 nolu grup">
<h:outputText value="3 Nolu XHTML" />
<br />
<p:commandButton id="buton" value="Print Me 3" actionListener="#{demo3MBean.printMe3}" />
</p:fieldset>
</h:form>
</ui:composition>
Demo3MBean.java
#ManagedBean(name = "demo3MBean")
#ViewScoped
public class Demo3MBean extends TlosSWBaseBean implements Serializable {
private static final long serialVersionUID = -504537811128309503L;
private String activePanel = FIRST_PANEL;
public final static String FIRST_PANEL = "first.xhtml";
public final static String SECOND_PANEL = "second.xhtml";
public final static String THIRD_PANEL = "third.xhtml";
public void onNodeSelect(NodeSelectEvent event) {
String nodeType = event.getTreeNode().getType();
if (nodeType.equals("First")) {
activePanel = FIRST_PANEL;
} else if (nodeType.equals("Second")) {
activePanel = SECOND_PANEL;
} else if (nodeType.equals("Third")) {
activePanel = THIRD_PANEL;
}
}
public void printMe1(ActionEvent e) {
System.out.println("Me 1");
}
public void printMe2(ActionEvent e) {
System.out.println("Me 2");
}
public void printMe3(ActionEvent e) {
System.out.println("Me 3");
}
public String getActivePanel() {
return activePanel;
}
public void setActivePanel(String activePanel) {
this.activePanel = activePanel;
}
}
DemoTreeBean.java
#ManagedBean(name = "demoTreeBean")
public class DemoTreeBean {
private TreeNode root;
#SuppressWarnings("unused")
public DemoTreeBean() {
root = new DefaultTreeNode("Root", null);
TreeNode node0 = new DefaultTreeNode("First", "First Node", root);
TreeNode node1 = new DefaultTreeNode("Second", "Second Node", root);
TreeNode node2 = new DefaultTreeNode("Third", "Third Node", root);
}
public TreeNode getRoot() {
return root;
}
}
I also read these :
JSF : dynamically loaded page commandButton not working
Primefaces commandButton action attribute not being called
BalusC answer - h:commandLink / h:commandButton is not being invoked
This part from main.xhtml is the cause of your problem.
<ui:define name="center">
<ui:include src="#{demo3MBean.activePanel}" />
</ui:define>
changing value of src at runtime does not work.
Try it with a static value like
<ui:define name="center">
<ui:include src="third.xhtml" />
</ui:define>
and you will see that buttons work.
Changing value of src at runtime will not work.
<ui:define name="center">
<ui:include src="#{demo3MBean.activePanel}" />
</ui:define>
Alternative solution to conquer your problem is using a rendered flag for your xhtml pages.For example
<ui:define name="center">
<s:div rendered="#{demo3MBean.firstFlag}">
<ui:include src="first.xhtml" />
</s:div>
<s:div rendered="#{demo3MBean.secondFlag}">
<ui:include src="second.xhtml" />
</s:div>
<s:div rendered="#{demo3MBean.thirdFlag}">
<ui:include src="third.xhtml.xhtml" />
</s:div>
</ui:define>
Set all pages flag to FALSE intially. Make the specific flag value as TRUE only when the relevant tree node is clicked. Do not forget to set unique "id" of all components of the included pages.
Using the above solution, attributes like action and actionListener of components such as commandButtons, commandLinks etc will also work normally and perfectly.
Hope this will solve your problem.
And also do not forget to accept my answer if it helps. Have a nice Day!!
It is just impossible to include a different file by updating the form inside of the included file. As you have the form rightForm in each of your files, you are only updating the rightForm of the currently loaded file when a tree node is selected. So there will never be a different file loaded.
Besides it is a bad approach to define the same form in each file when it exists in everyone (similiar for the growl).
To fix this remove the h:form in first.xhtml, second.xhtml and third.xhtml and change the second ui:define in your main.xhtml to the following:
<ui:define name="center">
<h:form id="rightForm">
<ui:include src="#{demo3MBean.activePanel}" />
</h:form>
</ui:define>
And why are you defining three p:treeNodes in the p:tree? As you are initializing the tree in the DemoTreeBean there is no need to define the treenodes manually. The p:tree is just iterating through the nodes of the given value, as you can see in the showcase. Try the following code to reduce the effort when adding more tree nodes:
<p:tree value="#{demoTreeBean.root}" var="node" id="tree" animate="true"
style="width:350px;height:720px" dynamic="true" cache="false"
selectionMode="single">
<p:treeNode type="#{node.data}">
<h:outputText value="#{node}" id="lblNode1" />
</p:treeNode>
<p:ajax event="select" update=":rightForm" listener="#{demo3MBean.onNodeSelect}" />
</p:tree>

JSF Primefaces Tree Node Beginner

I tried using the example of showcase tuts from primefaces.org. I copied exactly the same text in my xhtml file as well as TreeBean.java
But The tree structure never appears in the browser(m using IE9). An empty block appears instead of the tree. Is there anything I need to keep in mind when using tree nodes?
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.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>PrimeFaces</title>
</f:facet>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit position="north" size="100" resizable="true" closable="true" collapsible="true">
Header
</p:layoutUnit>
<p:layoutUnit position="south" size="100" closable="true" collapsible="true">
Footer
</p:layoutUnit>
<p:layoutUnit position="west" size="175" header="Left" collapsible="true">
<h:form id="form">
<p:tree value="#{treeBean.root}" var="node" id="tree">
<p:treeNode id="treeNode">
<h:outputText value="#{node}" id="lblNode"/>
</p:treeNode>
</p:tree>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center">
Welcome to PrimeFaces
</p:layoutUnit>
</p:layout>
</h:body>
</f:view>
You have to create and copy a TreeBean class too. It is avaible for every example on primefaces showcase site, next to xhtml's source code. To make it visible for EL you have to additionally annotate it #Named or #ManagedBean, and give it some reasonable lifecycle scope.
//EDIT:
#Named
#javax.enterprise.context.SessionScoped
public class TreeBean { ... }

Datatable as master, dialog as details

I'm trying to get that code working:
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition 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:p="http://primefaces.org/ui"
template="/templates/default.xhtml">
<ui:define name="content">
<h:form id="form">
<p:dataTable id="clienti" var="c" value="#{clientiController.clienti}" rowKey="#{c.id}">
<p:column headerText="Ragione sociale">
<h:outputText value="#{c.ragioneSociale}" />
</p:column>
<p:column headerText="Codice fiscale">
<h:outputText value="#{c.codiceFiscale}" />
</p:column>
<p:column style="width:4%">
<p:commandButton
update=":formDialog:clienteEditDialogTable"
oncomplete="clienteEditDialog.show()"
value="Modifica"
title="Modifica">
<f:setPropertyActionListener value="#{c}" target="#{clientiController.clienteSelezionato}" />
</p:commandButton>
</p:column>
</p:dataTable>
<p:commandButton value="Aggiorna" actionListener="#{clientiController.aggiorna}" update=":form:clienti" icon="ui-icon-arrowrefresh-1-n" />
<p:commandButton value="Nuovo Cliente" actionListener="#{clientiController.nuovo}" update=":formDialog:clienteEditDialogTable" oncomplete="clienteEditDialog.show()" />
</h:form>
<p:dialog
header="Modifica Cliente"
widgetVar="clienteEditDialog"
id="clienteEditDialog"
showEffect="fade"
hideEffect="explode"
closable="true"
modal="true"
appendToBody="true">
<h:form id="formDialog">
<h:panelGrid id="clienteEditDialogTable" columns="2" cellpadding="10" style="margin:0 auto;">
<p:outputLabel for="fieldNome" value="Ragione Sociale:" />
<p:inputText id="fieldNome" value="#{clientiController.clienteSelezionato.ragioneSociale}" />
<p:outputLabel for="fieldCodice" value="Codice:" />
<p:inputText id="fieldCodice" value="#{clientiController.clienteSelezionato.codiceFiscale}" required="true" requiredMessage="Codice fiscale obbligatorio" />
</h:panelGrid>
<p:commandButton
value="Conferma modifiche"
actionListener="#{clientiController.modifica}"
update=":form:clienti"
oncomplete="clienteEditDialog.hide()"
rendered="#{clientiController.clienteSelezionato.id!=null}" />
<p:commandButton
value="Conferma nuovo cliente"
actionListener="#{clientiController.crea}"
update=":form:clienti"
oncomplete="clienteEditDialog.hide()"
rendered="#{clientiController.clienteSelezionato.id==null}" />
</h:form>
</p:dialog>
</ui:define>
</ui:composition>
By clicking on "Nuovo Cliente" I get a javascript console error:
TypeError: 'undefined' is not a function (evaluating
'clienteEditDialog.show()')
It's a naming container misunderstanding of course.
Can you help me give the right ids?
In older primefaces version one could not assign the same name for widgetVar and id of a p:dialog
Try changing id="clienteEditDialog" into id="clienteEditDialogId"
You are referencing clienteEditDialogTable from different naming container. Actual id is
:formDialog:clienteEditDialogTable, so try with it. Id can be different but I can tell you more after you give the template source code.

Primefaces Slider does not call setter

I have a primefaces (version 3.4.2) slider and an inputText for output value of the slider value.
The problem is that a change of the slider update the displayed value of the inputText, but the setter bind to the inputText is not called.
Here is my slider:
<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:p="http://primefaces.org/ui"
xmlns:a4j="http://richfaces.org/a4j">
<h:head>
<title>Zinsrechner</title>
</h:head>
<h:body>
<h:form>
<h:panelGrid columns="1" style="margin-bottom:10px">
<p:inputText id="x" value="#{zinsrechner.monatlicherBeitrag}" />
<p:slider minValue="0" maxValue="150" for="x" />
</h:panelGrid>
</h:form>
</h:body>
</html>
And this is my Setter, which is NOT called:
public void setMonatlicherBeitrag( Double beitrag ) {
monatlicherBeitrag = beitrag;
}
The Getter IS called:
public Double getMonatlicherBeitrag() {
return GuiParameter.getSpareinlageProMonat();
}
Adding a <p:ajax> inside your Slider will to the trick.
Example:
<p:slider minValue="0" maxValue="150" for="x">
<p:ajax event="slideEnd" process="x" />
</p:slider>
I was facing the same problem, but in my case the thing was that I was setting the <p:inputNumber .../> label as read only. I removed that attribute and everything worked.