facelets

How to customize h:head when using ui:composition template?

霸气de小男生 提交于 2019-11-28 09:12:16
I am using JSF to render an HTML page. I design the page like it : <f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"> <h:head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta name="language" content="fr" /> <title><ui:insert name="title">My app</ui:insert></title> </h:head> <h:body> <div id="top"> <ui:include src="/header.xhtml"/> </div> <h:panelGroup id="center" layout="block" > <ui:insert name="center"/> </h

How to change head elements of a page when using ui:composition

China☆狼群 提交于 2019-11-28 09:09:37
I want to ask a question that i have a master template like this <?xml version='1.0' encoding='UTF-8'?> <!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:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <title>Login</title> </h:head> <h:body> <div id="top"> <ui:insert name="top"> <ui:include src="header.xhtml" id="header"/> </ui:insert> </div> <div> <div id="content"> <ui:insert name="content"></ui:insert> </div> </div> <div id="bottom"

Skip executing <ui:include> when parent UI component is not rendered

孤者浪人 提交于 2019-11-28 08:42:40
I have the following construct at several places in my webapp in order to conditionally render page fragments depending on some actions: <h:panelGroup rendered="#{managedBean.serviceSelected == 'insurance'}"> <ui:include src="/pages/edocket/include/service1.xhtml" /> </h:panelGroup> I have observed, that the <ui:include> is still executed even when the rendered attribute evaluates false . This unnecessarily creates all backing beans associated with the service1.xhtml file which is been included. How can I skip executing the <ui:include> when the parent UI component is not rendered, so that all

Stop Eclipse restarting my web app on file save

允我心安 提交于 2019-11-28 07:41:12
问题 I'm creating a JSF/Facelets web app in Eclipse. I've configured my project to use a Tomcat (6.0) server that is started/stopped by Eclipse. Whenever I save a file (eg .xhtml) Eclipse restarts the app, trashing my HTTP session. This is annoying, because I'm frequently updating my .xhtml files, and the app doesn't need restarting to detect the changes. Is there a way to stop Eclipse restarting the app? Specifically, can I configure Eclipse to only restart the app when I save files of a certain

Why not JSF pages are precompiled (atleast partially) but instead parsed, evaluated each time view is built?

故事扮演 提交于 2019-11-28 06:07:20
I don't know whether it is true or not but from what I've read, I believe, JSF EL & xhtml pages are not pre-compiled & just used when needed but instead they are parsed, evaluated, compiled each time the view is built. I fail to understand why this is done so! Why not just parse & compile it just once, ok atleast partially , rendering of some components may depend on a dynamically fetched variable so they may be rendered later but why delay that for all the components on page? Whatever maximum could be pre-compiled & made ready to use, why not do it just when the application is deployed? Wont

Concatenating strings within EL expression defined in an attribute of a facelets tag

大兔子大兔子 提交于 2019-11-28 05:16:17
I need to write an EL expression for an attribute which goes something like this: #{cc.attrs.appreciatedByCurrentUser ? (cc.attrs.count +'<br/>'+ (cc.attrs.count-1)) : ((cc.attrs.count+1) +'<br/>'+ cc.attrs.count)} Now the problem is that this gives an error as strings cannot be concatenated, the way I am doing it. So how can I rectify this? I'm using JSF 2.0 with facelets. EDIT : I'm resolving the issue using the following inline javascript <script type="text/javascript"> var count=#{cc.attrs.count}; document.write(#{cc.attrs.appreciatedByCurrentUser} ? (count-1) +'<br/>'+count : count+'<br/>

How to reference #{cc.clientId} in ajax update/process/render/execute?

那年仲夏 提交于 2019-11-28 04:41:31
问题 I don't know how to reference descendant components of composite component in update or process (alias render or execute ). I have this composite component resources/components/crud.xhtml : <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsf/composite"> <c:interface> <c:attribute name="controller" required="true" /

How to remove border from specific PrimeFaces p:panelGrid?

白昼怎懂夜的黑 提交于 2019-11-28 04:27:59
I have difficulty in removing border from a specific PrimeFaces <p:panelGrid> . <p:panelGrid styleClass="companyHeaderGrid"> <p:row> <p:column> Some tags </p:column> <p:column> Some tags </p:column> </p:row> </p:panelGrid> I have been able to remove border from the cells with: .companyHeaderGrid td { border: none; } But .companyHeaderGrid { border: none; } Does not work. BalusC The border is been set on the generated tr and td elements, not on the table . So, this should do: .companyHeaderGrid.ui-panelgrid>*>tr, .companyHeaderGrid.ui-panelgrid .ui-panelgrid-cell { border: none; } How I found

In JSF what is the shortest way to output List<SomeObj> as comma separated list of “name” properties of SomeObj

拜拜、爱过 提交于 2019-11-28 02:46:51
问题 I have a question about outputing a list of objects as a comma separated list in JSF. Let's say: public class SomeObj { private String name; ... constructors, getters and setters ... } and List<SomeObj>: List<SomeObj> lst = new ArrayList<SomeObj>(); lst.add(new SomeObj("NameA")); lst.add(new SomeObj("NameB")); lst.add(new SomeObj("NameC")); to output it as a listbox I can use this code: <h:selectManyListbox id="id1" value="#{listHolder.selectedList}"> <s:selectItems value="#{listHolder.lst}"

Datatable inside programatically added composite component

萝らか妹 提交于 2019-11-28 02:13:35
问题 Referring to my earlier question (Programmatically create and add composite component in backing bean) I have succesfully able to add composite components from backing bean. Now I have a new problem as composite component with lazy datatable in it does not call load() method at all. There was bug report about this (https://code.google.com/p/primefaces/issues/detail?id=3258) but that is marked to be related to PF3.0.RC1 and I have no clue if it is fixed for version 3.5 I am using. I am using