facelets

How to repeat output of text via simple for loop in Facelets without model?

风流意气都作罢 提交于 2019-12-02 15:53:06
How to repeat output of some content in JSF using only standard tags (ui:, h: etc) ? In other words - how to do equivalent to PHP code below in JSF ? I immediately wanted to take advantage of ui:repeat , but it needs collection - I have only number. for ($i = 0; $i < 10; $i++) { echo "<div>content</div>"; } Either use <c:forEach> instead (true, mixing JSTL with JSF is sometimes frowned upon, but this should not harm in your particular case because you seem to want to create the view "statically"; it does not depend on any dynamic variables): xmlns:c="http://java.sun.com/jsp/jstl/core" ... <c

How to use && in EL boolean expressions in Facelets?

时光总嘲笑我的痴心妄想 提交于 2019-12-02 15:41:54
I am having a little trouble figuring out how to do and's on EL expressions in Facelets. So basically I have: <h:outputText id="Prompt" value="Fobar" rendered="#{beanA.prompt == true && beanB.currentBase !=null}" /> But I keep getting: Error Traced[line: 69] The entity name must immediately follow the '&' in the entity reference. Facelets is a XML based view technology. The & is a special character in XML representing the start of an entity like & which ends with the ; character. You'd need to either escape it, which is ugly: rendered="#{beanA.prompt == true && beanB.currentBase != null}" or

Navigation in JavaServer Faces, redirecting with correct parameters

丶灬走出姿态 提交于 2019-12-02 15:21:58
问题 I have a page: http://mypage.com/items.jsf. This page takes the following for granted: ID is set by GET or ID is set by POST. Now, I can manually call items.jsf?ID=10 But what I really want to do is have a Button which calls a function that returns the navigation URL. public String test() { return "10"; } Now having the following code in the JSF file. <h:form> <h:commandButton action="#{itemsBean.test}" value="Redirect me" /> </h:form> What I want to happen is that when I press "Redirect me",

Referencing dataTable footer

萝らか妹 提交于 2019-12-02 13:26:23
问题 I am trying to use Ajax updates triggered from a component within a p:dataTable to update the footer of the table. But no matter how I write my ID references in the p:ajax tag I don't seem to be able to get them right. This is an example: <h:form id="formId"> <p:dataTable id="tableId" var="row" value="#{testBean.dataRows}" rowIndexVar="rowIx"> <p:column> <h:outputText value="#{row}"/> <p:inputText id="innerInputId" value="#{testBean.str}"> <p:ajax event="keyup" update="tableId:footerId"/> <p

Conditionally including a Facelet file via <ui:include>

青春壹個敷衍的年華 提交于 2019-12-02 10:40:09
I have 2 Facelets files (index.xhtml and report.xhtml). I use the RichFaces <ui:include src="report.xhtml"/> to load the report into the index. Works fine. But when I try to only show report on certain conditions, I fail! What does not work is this: <ui:include src="report.xhtml" rendered="#{indexService.contentName == 'report'}"/> . The rendered attribute of ui:include does not seem to work. How can I load the report.xhtml into the index.xhtml on certain conditions? Where is the error in my code? Edit: Half of it works now. Changing the Facelet file works with conditions. But the

<f:facet> not working with <h:form>

心不动则不痛 提交于 2019-12-02 09:27:10
问题 I have a template, in which a <h:form> is defined. This <h:form> is used all over the application for the CRUD pages of entities. So, at one place I need another enctype for the form, so that I can upload files. I thought I can solve this with a facet in the template: <h:form id="main-form"> <f:facet name="enctype"> <ui:insert name="form-enctype"/> </f:facet> <ui:insert name="buttons"/><p/> <ui:insert name="content"/><p/> <ui:insert name="buttons"/> <ui:insert name="additionalHelper"/> </h

Navigation in JavaServer Faces, redirecting with correct parameters

混江龙づ霸主 提交于 2019-12-02 09:12:39
I have a page: http://mypage.com/items.jsf . This page takes the following for granted: ID is set by GET or ID is set by POST. Now, I can manually call items.jsf?ID=10 But what I really want to do is have a Button which calls a function that returns the navigation URL. public String test() { return "10"; } Now having the following code in the JSF file. <h:form> <h:commandButton action="#{itemsBean.test}" value="Redirect me" /> </h:form> What I want to happen is that when I press "Redirect me", I want a Navigation-Rule to know that I want to go to: items.jsf?ID= 10 Is this possible? It feels

How to avoid repetitions / use constants in Facelets page?

不羁的心 提交于 2019-12-02 08:59:25
In a Facelets page, I have various <h:inputText> and <h:outputText> components, which all need the same converter. I'd like to avoid repeating the converter with all its parameters, like this: <h:inputText id="bla" value="#{mybean.val}" > <f:convertNumber locale="en" maxFractionDigits="3" minFractionDigits="3"/> </h:inputText> [...] <h:outputText id="bla2" value="#{mybean.val2}" > <f:convertNumber locale="en" maxFractionDigits="3" minFractionDigits="3"/> </h:outputText> [...] <h:inputText id="bla3" value="#{mybean.val3}" > <f:convertNumber locale="en" maxFractionDigits="3" minFractionDigits="3

JSF h tags not displaying [duplicate]

非 Y 不嫁゛ 提交于 2019-12-02 08:32:06
问题 This question already has an answer here : JSF returns blank/unparsed page with plain/raw XHTML/XML/EL source instead of rendered HTML output (1 answer) Closed last year . Using Netbeans to deploy a web app on Glassfish 3.1.2.2 and none of my h tags display on the web. For instance: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"> <head> <title>Draft Savvy Beers</title> </head> <h:form> <h:body> <h1>Search for beers</h1> <p><strong>Would you like to search

Reading bean list using jstl and assigning to javascript variable in facelets

拈花ヽ惹草 提交于 2019-12-02 08:31:22
I am using facelet and draw function has jstl tag: <ui:define name="content" > <h:outputScript name="js/graphics/paths.js"/> <h:outputScript name="js/graphics/draw.js"/> Tag to be evaluated when function is called(is that possible)? function showMap(){ var data = { <c:forEach items="${list.KPI}" var="ctag" varStatus="loop"> '${ctag.USTER}': ${ctag.Value} ${!loop.last ? ',' : ''} </c:forEach> } } Error: Is it possible to use jstl with facelets? Why am i getting this error? I am using there links: 1) is it possible for javascript to extract value from cforeach tag 2) populating-javascript-array