Render « Data « JSF Q&A

1. JSF boolean output

Is there a way in JSF to output some text based on a boolean? For example: h:outputText value="Black" rendered="#{bean.isBlack}" The bean property is called isBlack not getIsBlack...I dont want to rename this. Thanks, D

2. Factorizing the "rendered" attribute over several JSF elements

Given the following JSF fragment:

<h:outputText ... rendered="#{bean.r} />
<h:outputText ... rendered="#{bean.r} />
<h:outputText ... rendered="#{bean.r} />
How can I factorize to something that would look like:
<h:someKindOfGroupOrSomething rendered="#{bean.r}>
    <h:outputText ... />

3. How to render or hide a jsf subview based on a method call (which returns boolean)?

I have a context loader class which loads an XML file with info on which components to show or hide on a page. On the JSP pages, within the 'rendered' ...

4. JSF 2.0 Input field rendered by Ajax cannot be used to input values?

    Do you have a driving license?
    <h:selectOneMenu value="#{requestScope.license}">
        <f:selectItem itemLabel="Select..." itemValue=""/>

5. Making JSF website multilingual

Trying to make JSF web application multilingual. For that purpose cover all the HTML code with <f:view> tags:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns= ... >

<f:view locale="#{actionsContainer.languageDetails.locale}">

6. Can I set the value for rendered attribute from JavaScript?

Can I set the value for rendered attribute of h:commandLink from JavaScript?

<h:commandLink id="profileLink" rendered="#{bean.enable}">

7. JSF: Empty space caused by rendered attribute

How can I get rid of the empty space by components not rendered via rendered attribute? I want to display a list of objects in a dataTable and sort them by a ...

8. JSF: rendered attribute

I have a panelGroup with a rendered attribute. Why is it that the component values in the panelGroup are even called if the rendered attribute is set to false? Do I ...

9. 2 Mutually Exclusive InputComponents Referring to the same Field is updating the same field Twice

I have a screen with 2 JSF Input Components: inputText and inputText with suggestionBox. They are both bound to the same field, but only one can be visible/rendered (mutual exclusion).
The ...

10. How to disable a nested heading html element using jsf rendered attribute

I have a JSF page that contains:

<div class="tableCaption">
  <h2>Batch Details</h2>
and a CSS that defines the look of .tableCaption h2 I want to wrap the above div in a JSF component that ...

11. JSF javascript boolean rendered

Whats the easiest way to toggle the rendering of a JSF Component based on a javascript flag? I want to display certain things based on whether the user has HTML5 enabled...e.g. geolocation, ...

12. JSF selectBooleanCheckbox not calling the associated setter method if it is conditionally rendered

I'm using Mojarra 2.0.3 on JBoss 6.1.0 final. I'm having a problem with the value setter method for an h:selectBooleanCheckbox not being called if conditional rendering is specified in the tag. ...

13. Setting "rendered" attribute via javascript?

Originally posted by Leo Budima: I know of DWR and it's great - this solution has crossed my mind, but is an overkill since I just need to show some hidden components that are allready on the page, and I think this must be possible via client-side scripting, but am to new to JSF to know exactly how Only one way ...

14. Question about rendered attribute

16. JSF rendered attribute

17. Problem using rendered attribute in Command Button

Hello Nitin, You need to have a look at your action attribute. It should be an EL expression, that should point to some method on your managed bean. It it returns nothing or null, you will be redirected back to the page the call came from. If you have a navigation case defined in your faces config xml file, and this ...

18. Rendered attribute of child of unrendered parent

Consider this bit of JSF code: In the above example, the boolean method isFirstTest() is called. If it returns false, we don't want to output either of the child outputText values. If it returns true, then we want to output the first child outputText value ("Hello"), and we might or might not want ...

19. rendered attribute of output

Can you use a function inside of the rendered attribure? Rendered takes a true/false value. What I'm trying to do is compare to backing bean values to determine if link should be displayed. Something like this: rendered="#{!(frCodeBeingDisplayed == loggedInAs)}" The above doesn't work. What I have found is that you can set rendered to a backing bean value (True or False), ...

20. JSF Rendered attribute question

21. Panel Grid and render attribute

23. Problem with attribute rendered

25. Rendered attribute not working

26. JSF Render Attribute - Array Length

29. h:panelGroup rendered attribute

Well, your panelGroup is inconsistent with your use of raw HTML for the table, for one thing. You'd typically use panelGroup with panelGrid and dispense with the HTML tags altogether. However, panelGroup is for putting multiple things in one column that would normally each get their own separate column, not for optional rows. I'm pretty sure, however, that if you don't ...