rendered-attribute

How to conditionally render an f:selectItem tag?

倾然丶 夕夏残阳落幕 提交于 2019-11-27 04:28:21
How can I specify a conditional rendering for an <f:selectItem> tag. I need to display <f:selectItem> options according to a specific user's status. For example, I wanted something like: <f:selectItem itemLabel="Yes! I need a girlfriend!" rendered="false(or some boolean condition)" itemValue="o1"/> BalusC The <f:selectItem> does not support the rendered attribute. Your closest bet is the itemDisabled attribute which still displays the item, but makes it unselectable. This is also supported in <f:selectItems> . In case of <p:selectOneMenu> you can then just add some CSS to hide disabled items.

javax.el.PropertyNotFoundException when submitting ui:repeat with conditionally rendered properties of different subclasses

六月ゝ 毕业季﹏ 提交于 2019-11-27 02:58:48
问题 In my backing-bean I have a collection of objects of different subclasses sharing a common interface. Inside the view, an ui:repeat iterates over this collection. Inside this loop, different properties have to be rendered depending on the concrete implementation of the interface. I reduced the problem to the following backing bean: @Named @SessionScoped public class DummyBean implements Serializable { private List<Type> objects = new ArrayList<Type>(); public void add1() { objects.add(new

How to conditionally render an f:selectItem tag?

旧街凉风 提交于 2019-11-26 11:15:58
问题 How can I specify a conditional rendering for an <f:selectItem> tag. I need to display <f:selectItem> options according to a specific user\'s status. For example, I wanted something like: <f:selectItem itemLabel=\"Yes! I need a girlfriend!\" rendered=\"false(or some boolean condition)\" itemValue=\"o1\"/> 回答1: The <f:selectItem> does not support the rendered attribute. Your closest bet is the itemDisabled attribute which still displays the item, but makes it unselectable. This is also

Ajax update/render does not work on a component which has rendered attribute

荒凉一梦 提交于 2019-11-25 21:59:14
问题 I\'m trying to ajax-update a conditionally rendered component. <h:form> ... <h:commandButton value=\"Login\" action=\"#{login.submit}\"> <f:ajax execute=\"@form\" render=\":text\" /> </h:commandButton> </h:form> <h:outputText id=\"text\" value=\"You\'re logged in!\" rendered=\"#{not empty user}\" /> However, that does not work. I can assure that #{user} is actually available. How is this caused and how can I solve it? 回答1: It's not possible to re-render (update) a component by ajax if the