facelets

JSF1.2: difference between ui:repeat, a4j:repeat and t:datalist tags

。_饼干妹妹 提交于 2019-12-10 14:21:57
问题 Do you know what is the difference between the tags mentioned in the subject? I thought they should produce pretty much the same result but it turned out that in some cases ui:repeat (a facelets tag) is not working as you would expect, although it's also considered a basic iteration component. t is for tomahawk and a4j is a richfaces prefix. Any comment is welcome. 回答1: Facelets' ui:repeat has indeed bugs in certain situations. As to the difference with the other two, it boils down that it's

How do you call List.size() from a JSF 2.0 Facelets Template?

早过忘川 提交于 2019-12-10 12:44:37
问题 What is the syntax for calling list.size() in a JSF 2.0 Facelets template (eg, using an h:outputText element)? 回答1: How about this: <h:outputText value="#{fn:length(someBean.someList)}" /> You'll need to reference the functions taglib in your JSF page (URI: http://java.sun.com/jsp/jstl/functions ). 回答2: Just try #{myBean.myList.size()} 回答3: It's not a problem with JSF 2.0 exactly. The JSF spec still requires a class that conforms to the bean spec. The collection classes don't do that with the

Dynamic ui:include inside ui:repeat. Is there a simple solution?

余生颓废 提交于 2019-12-09 18:05:09
问题 I want to dynamically pick a facelet to render some item in my data list. The first try would be: <ui:repeat value="#{panels}" var="panel"> <ui:include src="#{panel.facelet}"> </ui:repeat> But it won't work since src of ui:include is evaluated too early. The facelet information is truly dynamic, so I cannot use c:forEach (not really recommended to mix with facelets either). I guess it all boils down to finding a component based ui:include alternative. Is there such thing or I need to write my

JSF - Pass a parameter on ajax call - What's wrong on this code?

耗尽温柔 提交于 2019-12-09 17:58:22
问题 I need to pass a parameter to a bean when i do an ajax call. My bean is this : @ManagedBean @RequestScoped public class Selector { @ManagedProperty(value="#{param.page}") private String page; @PostConstruct public void init() { if(page==null || page.trim().isEmpty()) { this.page="homepage"; } System.out.println(this.page); } public String getPage() { return page; } public void setPage(String page) { this.page=page; } } And, when i do the ajax call, i need (due to the fact that i want to

How to reference Facelets taglib in JAR from Facelets and web.xml?

偶尔善良 提交于 2019-12-09 12:11:37
问题 I am using the Apache MyFaces Commons Validator TagLib. How should i add this to my web.xml? The commons JAR is downloaded and resolved through Maven. XHTML (I think this is correct): <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.prime.com.tr/ui" **xmlns:mcv="http://myfaces.apache.org/commons/validators"**> web.xml: <context-param> <!-- To add additional tab libs --> <param-name>facelets

JSF, override HTTP headers

浪子不回头ぞ 提交于 2019-12-09 10:16:51
问题 I strongly need to override JSF 2.0 Content-Type header. Default it is Content-Type:application/xhtml+xml; charset=UTF-8 But I need Content-Type:text/html; charset=UTF-8 Thanks. 回答1: How about <f:view contentType="text/html" /> 回答2: Use the right doctype. <!DOCTYPE html> Nothing more. Also don't put <?xml?> declaration at top. Here's a minimum template: <!DOCTYPE html> <html xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf

PrimeFaces DataTable CellEdit get entity/object

不问归期 提交于 2019-12-09 09:15:41
问题 I have a datatable which displays various entities based on a List<>. When I select a cell for editing I want to be able to also get the entity somehow in order to update it. Of course there is event.getRowIndex, which I can then use with the List<>, but that is not always convenient. Is there perhaps another way to get the entity from CellEditEvent? 回答1: One way would be to programmatically EL-evaluate the current <p:dataTable var> . Given a <p:dataTable value="#{bean.entities}" var="entity"

JSF <h:outputFormat>: use array values as parameters

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 06:12:36
问题 On my JSF2 page, i'm using internationalized error messages. In my backing bean, i'm putting the messages into the flash Scope: flash.put("error", exception.getType()); On the page, this string gets translated this way: <h:outputText value="#{bundle[flash.error]}"/> Works fine. NOW i want to be also able to put (an arbitrary number of) parameters into the message text, that get inserted into the placeholders in the i18n-property in my message.properties. Therefore, i'm putting the parameters

How do I include a body into a tagfile

人盡茶涼 提交于 2019-12-09 03:03:28
I have a tagfile I intend to use as an input template: <ui:composition xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> <div class="qr"> <label>#{question}</label> <div class="helpButton"></div> <!-- body here --> <!-- errors output eventually to go here --> </div> </ui:composition> It is stored in my /WEB-INF/tags folder with a .taglib.xml and necessary web.xml context-param. I understand it could be used as follows: <g:question question="What is your name?" id="firstname"> <h

JSF view getting rebuild on each ajax request

谁都会走 提交于 2019-12-09 02:43:20
问题 I'm having a performance problem with my JSF/RichFaces/Facelets ajax requests and from what I can tell its because the entire component tree is being rebuild on each ajax request. This is happening even if I use ajaxSingle=true, wrap sections in a4j:region, declare a single section for rerendering or none at all. Our page is a dynamic page with many nested levels. The page may contain around 800-900 fields (inputText, rich calendars, selectOneMenus, etc). The initial load time is an issue,