p:selectBooleanCheckbox visibility property [duplicate] - jsf

This question already has answers here:
Conditionally displaying JSF components
(3 answers)
Closed 2 years ago.
I am new to primefaces and JSF. I want to make selectBooleanCheckbox visible by depending on some Boolean value in my bean. But there is no visibility feature. And if I add a panel the design changes. So do you have any suggestions?
<p:selectBooleanCheckbox id="idCheckbox" value="#{bean.object.value}" itemLabel="{bean.object.value.label}" styleClass="width100Percent" disabled="{bean.infomode}">

You can add "rendered" attribute to control whether the component is displayed.
<p:selectBooleanCheckbox id="idCheckbox"
value="#{bean.object.value}"
itemLabel="#{bean.object.value.label}"
styleClass="width100Percent"
disabled="#{bean.infomode}"
rendered="#{bean.showIt}"
>

Related

get the list of element in <ui:repeat> already checked in JSF [duplicate]

This question already has answers here:
How to use <h:selectBooleanCheckbox> in <h:dataTable> or <ui:repeat> to select multiple items?
(3 answers)
Closed 5 years ago.
I have an <ui:repeat> in which I has a list of object , next to each of those object I need to have a checkbox ( to check this element).
I want to know how could I integrate those checkboxes inside the <ui:repeat> in order to have many rows and each rows needs to has the object.getName() and next to it I need to have the checkbox ?
If this is feasible, Please how could I obtain those checked objects in the backing bean ?
<ui:repeat var="myObject" varStatus="status"
value="#{Bean.getListObjects}">
<b>#{status.index+1} .</b>
<h:outputLabel value="#{myObject.name}" />
//need the checkbox here for example
</ui:repeat>
Just create a map with the object UID as the key and a boolean as the value. Then value-bind each checkbox to a map entry.
Assuming your names are unique, you could use them. So, in you bean create a Map<String,Boolean>, and initialize the map with each object.
You can use the map to in the checkbox value like value="#{bean.map[object.name]}".
See also:
Dynamic value binding of JSF component

How can I reset PrimeFaces tabs [duplicate]

This question already has answers here:
Reset input fields in primefaces
(5 answers)
Clear JSF form input values after submitting
(5 answers)
Closed 6 years ago.
I have A PrimeFaces wizard each tab contains InputText fields or SelectOneMenu menus ... how could I reset all fields and menus in all tabs on submit button ??
I'm using primefaces 5.3
thank you
PrimeFaces has a component for clientside resets
<p:commandButton value="Reset Tag" update="#form" process="#form" style="margin-right:20px;" >
<p:resetInput target="***idFromYourTag***" />
</p:commandButton>
If you need reset the backing bean values, you need to write a method.
See also ResetInput

how to add tooltip for selectItems tag in JSF [duplicate]

This question already has answers here:
How to add tooltip to f:selectItems
(2 answers)
Closed 6 years ago.
<h:selectOneMenu id="sType"value="#{sBean.sCriteria.sType}" style="width:200px;" styleClass="black" onchange="sTypeChanged();">
<f:selectItems value="#{sBean.allSTypes}" />
</h:selectOneMenu>
I am using the above code in my xhtml file.
I want to add "tool tip" in my selectOneMenu tag.
How can I do this?
Please look at this question hope ot helps
How to add tooltip to f:selectItems
Try ans use the title attributes best thing will be to bind the title in a map in the backing bean and use it here dynamically
Use the title attribute of selectOneMenu
<h:selectOneMenu id="sType"
title="tooltip_goes_here"
...
http://docs.oracle.com/javaee/5/javaserverfaces/1.2/docs/tlddocs/h/selectOneMenu.html

Using rendered with JSF [duplicate]

This question already has an answer here:
Why do I need to nest a component with rendered="#{some}" in another component when I want to ajax-update it?
(1 answer)
Closed 7 years ago.
How does rendered work? It hides h:form content completely and does not show it if expression.list is not empty.
<h:form id="stackForm" rendered="#{not empty expression.list}">
<p:orderList id="stack" value="#{expression.list}"...
...
It doesn't hide it - it doesn't render it at all, if rendered condition evaluates to false. In your case, if #{expression.list} is empty, form will not be rendered. Or, when rendered is translated to plain English, read it as Render the form if expression.list is not empty.

How to pass parameters panelgroup - binding, JSF [duplicate]

This question already has answers here:
How does the 'binding' attribute work in JSF? When and how should it be used?
(2 answers)
Closed 8 years ago.
I have a datatable that reads registers from a database.
In the datatable I have a panelgroup that is populated by binding
My problem is that I can not pass a parameter. I want to pass a value from the datatable variable, in that case preg, on each row I want to know the value of the register read to populate the panelgroup.
If I display the value it works fine for each row: #{preg.idpreg}
<h:dataTable var="preg" value="#{Pregbacking.list(Pregbacking.idenq)}">
<h:column>
#{preg.idpreg}
<h:panelGroup binding="#{Pregbacking.dynamicDataTableGroup(preg.idpreg)}"/>
</h:column>
</h:dataTable>
Does anybody know how can I solve this?
That should work just find but I believe that you need to make sure you are using a modern servlet spec (v3 I think). Use the latest Glassfish or Tomcat app server.

Resources