conditional-rendering

How to conditionally render plain HTML elements like <div>s?

这一生的挚爱 提交于 2019-11-26 07:34:41
问题 I\'m trying to implement a composite component which either displays the information details of a user in plain text or displays them through editable input texts fields if the desired details are those of the user currently connected. I know that al UI Components can be rendered via the rendered attribute but what about the ones which are not UI Components (for example divs) <div class = \"userDetails\" rendered = \"#{cc.attrs.value.id != sessionController.authUser.id}\"> Name: #{cc.attrs

JSTL c:if doesn&#39;t work inside a JSF h:dataTable

偶尔善良 提交于 2019-11-25 23:42:26
问题 I\'m trying to use <c:if> to conditionally put a <h:outputLink> inside a <h:dataTable> when the state is finished. <h:dataTable value=\"#{bean.items}\" var=\"item\" width=\"80%\"> <h:column> <f:facet name=\"header\"> <h:outputText value=\"State\" /> </f:facet> <c:if test=\"#{item.state != \'Finish\'}\"> <h:outputText value=\"Missing value\" /> </c:if> <c:if test=\"#{item.state == \'Finish\'}\"> <h:outputLink value=\"myLink\"> <h:outputText value=\"Value = #{item.state}\" /> </h:outputLink> <

Conditionally displaying JSF components

夙愿已清 提交于 2019-11-25 22:36:24
问题 First, I am new to Java EE, came from a strong ASP .NET development background. I have gone through the net, and I might miss this but it seems like there is no simple and straight-to-the-point tutorials on how I could connect backing bean class to a JSF components. A good example is like this, currently I am trying to create a JSF page where there is a set of links as menu bar and a set of forms. What I am planning to do is, when clicking a link, a particular form will be rendered. In ASP

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

Why do I need to nest a component with rendered=“#{some}” in another component when I want to ajax-update it?

大憨熊 提交于 2019-11-25 21:57:52
问题 So I\'ve found a few answers close to this, and I\'ve found enough to fix the problem I had. But even so, I\'m curious as to understand the workings around this. Let me illustrate with an example : I have a facelet .xhtml page that looks like this (shortned). <h:form id=\"resultForm\"> <h:panelGroup class=\"search_form\" layout=\"block\"> <h:inputText id=\"lastname\" value=\"#{search.lastname}\"/> <h:commandButton action=\"#{search.find}\" value=\"Find\"> <f:ajax execute=\"lastname\" render=\