conditional-rendering

Conditional render in tagfile depending on whether the attribute is specified or not

丶灬走出姿态 提交于 2019-12-11 04:17:03
问题 I have a Facelet tagfile and need to render different components depending on whether the attribute is specified or not. I tried it as below, <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" xmlns:pe="http://primefaces.org/ui/extensions" xmlns:c="http://java.sun.com/jsp/jstl/core"> <h:panelGrid columns="1"> <p:outputLabel value="test1

JSF render dir=“rtl” when language is arabic

心已入冬 提交于 2019-12-10 11:26:02
问题 I want to render the text direction rtl (Right-To-Left) in an inputText when the browser's Accept-Language is arabic in my JSF application. When Accept-Language is english the text introduced by the user would be dir="ltr" (Left-To-Right). How can I do it? 回答1: The client's Accept-Language is indirectly available via UIViewRoot#getLocale(). The UIViewRoot is in turn in EL available as #{view} . So, this should do: <h:inputText ... dir="#{view.locale.language eq 'ar' ? 'rtl' : 'ltr'}" /> Note

How to NOT initialize beans on page load associated with conditionally rendered content

旧巷老猫 提交于 2019-12-08 09:41:18
问题 I have a single page with conditionally rendered content controlled by several links in a sidemenu. All of that content has a datatable that is rendered false by default. Everything is working, except that when the page loads all of the beans are being executed and all beans are doing expensive database work. I would like that when a sidemenu is clicked by user, the corresponding datatable will render and only then the associated managed bean will be initialized. How can I achieve this? 回答1:

JSF render dir=“rtl” when language is arabic

旧街凉风 提交于 2019-12-06 09:41:52
I want to render the text direction rtl (Right-To-Left) in an inputText when the browser's Accept-Language is arabic in my JSF application. When Accept-Language is english the text introduced by the user would be dir="ltr" (Left-To-Right). How can I do it? BalusC The client's Accept-Language is indirectly available via UIViewRoot#getLocale() . The UIViewRoot is in turn in EL available as #{view} . So, this should do: <h:inputText ... dir="#{view.locale.language eq 'ar' ? 'rtl' : 'ltr'}" /> Note that the dir is also supported on all other components and HTML elements, such as <h:form> and even

Value expressions still evaluated despite ui:fragment rendered=“false”

与世无争的帅哥 提交于 2019-12-02 10:13:54
I have bean: class Property{ private String type; private Date value; //getters and setters } also have block of code on page: <ui:fragment rendered="#{property.type eq 'checkbox'}"> <ui:include src="checkbox.xhtml"> <ui:param name="property" value="#{property}"/> </ui:include> </ui:fragment> checkbox.xhtml: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core">

Conditionally displaying JSF components

跟風遠走 提交于 2019-12-02 08:07:41
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.NET, I could easily retrieve the element and then set the attribute to be displayable. I am wondering if

Input value not processed in request scoped bean when using conditional rendering

。_饼干妹妹 提交于 2019-12-02 03:48:11
问题 I know this type of question has been asked million times here, but I couldn't find a solution for my problem in relevant posts. JSF 1.2 I have a request-scoped bean with a method used as valueChangeListener: class DoStuff{ ... public void step1ChkStuffIncluded_CheckedChanged(ValueChangeEvent event){ StuffDocument cd = (StuffDocument)getInfo("StuffDocument"); if(cd == null){ Logger.Error("DoStuff", "step1ChkStuffIncluded_CheckedChanged", "No stuff document (null)"); return; } if

How not to set an attribute of a component inside a composite component if it is empty?

五迷三道 提交于 2019-12-01 11:27:30
I have a h:graphicImage in a composite component like this: <composite:interface> <composite:attribute name="name" required="true" type="java.lang.String" /> <composite:attribute name="alt" required="false" type="java.lang.String" /> <composite:attribute name="height" required="false" type="java.lang.String" /> <composite:attribute name="width" required="false" type="java.lang.String" /> </composite:interface> <composite:implementation> <h:graphicImage url="something-common#{cc.attrs.name}" alt="#{cc.attrs.alt}" height="#{cc.attrs.height}" width="#{cc.attrs.width}" /> </composite

How not to set an attribute of a component inside a composite component if it is empty?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 07:39:38
问题 I have a h:graphicImage in a composite component like this: <composite:interface> <composite:attribute name="name" required="true" type="java.lang.String" /> <composite:attribute name="alt" required="false" type="java.lang.String" /> <composite:attribute name="height" required="false" type="java.lang.String" /> <composite:attribute name="width" required="false" type="java.lang.String" /> </composite:interface> <composite:implementation> <h:graphicImage url="something-common#{cc.attrs.name}"

Conditionally render a component based on selectOneMenu value

天涯浪子 提交于 2019-11-29 12:28:25
Is there a way to render a component based on the current value the user has selected from a selectOneMenu component? My selectOneMenu component is populated with an enum consisting of two values, smoker and non-smoker. If the user has smoker selected I want to render a checkbox below it which lets the user check how many they smoke a day 10, 20, 30+, etc. I also want the opposite to work if they user has selected non-smoker i.e. the check boxes don't render/disappear. BalusC Just check the dropdown menu's value in the rendered attribute of the target components and update their common parent