facelets

Test if ui:insert has been defined in the template client

十年热恋 提交于 2019-11-29 06:15:44
I am wondering if it is possible to know if ui:insert was defined in the ui:composition . I know that I can do it using separate ui:param , but just wanted to do it without in order to keep it simple and less error prone. Example : Template ... <ui:insert name="sidebar" /> <!-- Conditionnaly set the class according if sidebar is present or not --> <div class="#{sidebar is defined ? 'with-sidebar' : 'without-sidebar'}"> <ui:insert name="page-content" /> </div> ... Page 1 ... <ui:define name="sidebar"> sidebar content </ui:define> <ui:define name="page-content"> page content </ui:define> ...

JSF ui:include not being rendered properly

自古美人都是妖i 提交于 2019-11-29 05:21:23
I'm implementing a web application using JSF 2.1.8 and I have a problem with the ui:include tag. I have this code <h:panelGroup id="panelContenido"> <ui:fragment rendered="#{!empty navigationManagerSystem._Navegable}"> <ui:include src="#{navigationManagerSystem._Navegable._IncludePath}" /> </ui:fragment> <ui:fragment rendered="#{empty navigationManagerSystem._Navegable}"> <ui:include src="/system/navigation/error.xhtml" /> </ui:fragment> </h:panelGroup> The navigationManagerSystem bean is JSF session managed and when this piece of code is firstly rendered, it is supposed to show the include

Pass parameters to messages from resource bundle to components other than **h:outputFormat**

被刻印的时光 ゝ 提交于 2019-11-29 03:58:25
Is there a convenient way to pass parameters to messages from resource bundle to components other than h:outputFormat ? For instance, this is legal: <h:outputFormat value="#{myBundle['parametricMessage']}"> <f:param value="#{myBundle['someParameterValue']}"/> </h:outputFormat> But I need it for a button, like this (which won't work): <h:commandButton value="#{myBundle['parametricMessage']}"> <f:param value="#{myBundle['someParameterValue']}"/> </h:commandButton> Of course, I can use link instead of button, and I can make it through a property in a managed bean, but in this question I'm seeking

<ui:debug/> tag not working in Facelets (JSF 2.0)

梦想与她 提交于 2019-11-29 00:29:27
问题 I am doing a project using JSF 2.0 and Facelets. I have read documentations that the <ui:debug/> tag gives valuable troubleshooting information upon pressing CTRL-SHIFT-D. But this never works for me. Please anyone tell me what am I missing. (I tried with various hotkeys, still no success. eg: <ui:debug hotkey="a"/> ) 回答1: Ensure that you pick a key which isn't reserved by the webbrowser itself. In case of Firefox, a good choice is x . <ui:debug hotkey="x" /> See also: how to debug JSF/EL

JSF 2.0: How to skip JSR-303 bean validation?

為{幸葍}努か 提交于 2019-11-28 18:54:55
How to skip JSR-303 Bean validation with JSF, when a button is clicked? A bit lengthy question to explain a few approaches... Consider a list in a form: <h:form id="form"> <h:commandButton value="Add row"> <f:ajax execute="foo" listener="#{bean.add()}" render="foo" /> </h:commandButton> <h:dataTable id="foo" var="foo" value="#{bean.foos}"> <h:column> Name: <h:inputText id="field" value="#{foo.name}" required="true" /> <h:messages for="field" /> </h:column> <h:column> <h:commandButton value="Remove"> <f:ajax execute=":form:foo" listener="#{bean.remove(foo)}" render=":form:foo" /> </h

Facelets repeat Tag Index

拥有回忆 提交于 2019-11-28 16:50:57
Does anyone know a way to get the index of the element in a ui:repeat facelets tag? <ui:repeat id="topTenGrd" var="dream" value="#{dreamModifyBean.topDreams}"> <h:outputText class="dream-title uppercase" value="#{dream.number}. #{dream.title}" /> </ui:repeat> Brian Leathem Specify a value for the "varStatus" attribute: <ui:repeat id="..." var="..." value="..." varStatus="myVarStatus"> You can then access the loop index via EL: #{myVarStatus.index} Additionally, the following properties are available to the varStatus: begin of type Integer end of type Integer index of type int step of type

How do I insert non breaking space character   in a JSF page?

与世无争的帅哥 提交于 2019-11-28 16:36:52
How do I insert a non breaking space character in JSF page like I can in HTML using   ? Is there such a tag in JSF? this will work <h:outputText value=" " /> Putting the HTML number directly did the trick for me:   If your using the RichFaces library you can also use the tag rich:spacer which will add an "invisible" image with a given length and height. Usually much easier and prettier than to add tons of nbsp;. Where you want your space to show you simply add: <rich:spacer height="1" width="2" /> You can also use primefaces <p:spacer width="10" height="10" /> Eventually, you can try this one,

how to see docs for jsf/facelets elements in eclipse

与世无争的帅哥 提交于 2019-11-28 13:56:01
I am using helios 3.6.2. I have an .xhtml opened with Web Page Editor <!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:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" > <f:view> <h:head> ... </h:head> when ever I hover over an element,e.g. f:view, I only see : Element : f:view rather than the description which suppose to be the following according to the tld: Creates a JSF View, which is a container that

How to include a JSP page in a Facelets page?

左心房为你撑大大i 提交于 2019-11-28 13:55:45
I am using Myfaces 2 on Facelets. I have to include a JSP page in a Facelet page. I tried using <ui:include> but it takes only XHTML pages. I also tried using <c:import> and <f:subview> but nothing worked. Googled a lot but didn't get the exact answer. How can I achieve the requirement? BalusC That's possible with a custom UIComponent . My fellow colleague has written a blog article about this a year ago: Facelets and legacy JSP . It's some code, but the principle is easy, the component does a RequestDispatcher#include() with a custom HttpServletResponseWrapper which captures the written

Untraceable errors in XHTML templates caused by a missing space between attributes among (X)HTML tags

落花浮王杯 提交于 2019-11-28 13:05:42
问题 Have a simple question. Let's consider the following tag. <h:inputText id="text" value="#{bean.value}"/> If it is mistakenly written as follows. <h:inputText id="text"value="#{bean.value}"/> Please notice that there is no space between the id and the value attributes in this case. This is expected to be a parse error that should occur during parsing of the XHTML file possibly throwing an appropriate exception. If it were to happen, absolutely nothing exceptional would be reported. No errors