facelets

Programmatically get expression value of facelets parameter (variable)

大兔子大兔子 提交于 2019-12-01 00:56:00
Following java code allows to access any object or variable from faces context: ELContext elCtx = facesContext.getELContext(); ExpressionFactory exprFac = facesContext.getApplication().getExpressionFactory(); MyProperty myProperty = (MyProperty) exprFac.createValueExpression(elCtx, "#{somebean.someattr.someproperty}", MyProperty.class).getValue(elCtx); I use the code from within my custom converter to read additional converting parameters from context. The code works correctly if #{somebean} is defined as normal backing bean within JSF context. Facelets allow to create 'shortcut' to JSF

JSF 2.0: h:inputText inside composite component fails with non-String objects when validation is set

∥☆過路亽.° 提交于 2019-12-01 00:39:20
In a backing bean: @Min(3) Integer foo; If I have form like: <h:form> <h:commandButton value="Submit" /> <h:inputText value="#{bean.foo}" /> </h:form> This works ok. However, if I do something like <cc:interface> <cc:attribute name="text" /> <cc:editableValueHolder name="text" targets="field" /> <cc:interface> <cc:implementation> <h:inputText id="field" value="#{cc.attrs.text}" /> </cc:implementation> and call this inside form instead of directly h:inputText as in: <!-- <h:inputText value="#{bean.foo}" /> --> <pref:fieldComponent text="#{bean.foo}" /> But then I get: javax.validation

Custom JSF component which adds new child to page “head” facet

最后都变了- 提交于 2019-11-30 23:51:08
I want to create custom component which adds new child to page "head" facet. This custom component is based on h:selectOneMenu. When used on jsf page, user can simply change the current theme. What I need this component to do is to add stylesheet child to head facet. My component has backing java. I tried to modify "head" in encodeBegins() method, but my child is not rendered at all. Take a look at the implementation: @FacesComponent(value = "com.ramps.util.ThemeSelector") public class ThemeSelector extends UIInput implements NamingContainer { public void encodeBegin(FacesContext context)

JSF template: rendered page missing DOCTYPE

血红的双手。 提交于 2019-11-30 23:17:07
TL;DR: I can't get the DOCTYPE header to appear on my JSF pages. I just inherited a JSF 1.2 project that's having some display issues under IE. I'm brand new to JSF, but I think the issues stem from the fact that the rendered pages (from "view source") do not contain a proper DOCTYPE . The pages are composed of multiple parts, brought together using several layers of <ui:composition> . A typical page will look like: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui

Programmatically get expression value of facelets parameter (variable)

你离开我真会死。 提交于 2019-11-30 20:37:32
问题 Following java code allows to access any object or variable from faces context: ELContext elCtx = facesContext.getELContext(); ExpressionFactory exprFac = facesContext.getApplication().getExpressionFactory(); MyProperty myProperty = (MyProperty) exprFac.createValueExpression(elCtx, "#{somebean.someattr.someproperty}", MyProperty.class).getValue(elCtx); I use the code from within my custom converter to read additional converting parameters from context. The code works correctly if #{somebean}

JSF 2.0: h:inputText inside composite component fails with non-String objects when validation is set

落爺英雄遲暮 提交于 2019-11-30 19:59:52
问题 In a backing bean: @Min(3) Integer foo; If I have form like: <h:form> <h:commandButton value="Submit" /> <h:inputText value="#{bean.foo}" /> </h:form> This works ok. However, if I do something like <cc:interface> <cc:attribute name="text" /> <cc:editableValueHolder name="text" targets="field" /> <cc:interface> <cc:implementation> <h:inputText id="field" value="#{cc.attrs.text}" /> </cc:implementation> and call this inside form instead of directly h:inputText as in: <!-- <h:inputText value="#

Custom JSF component which adds new child to page “head” facet

自闭症网瘾萝莉.ら 提交于 2019-11-30 18:34:08
问题 I want to create custom component which adds new child to page "head" facet. This custom component is based on h:selectOneMenu. When used on jsf page, user can simply change the current theme. What I need this component to do is to add stylesheet child to head facet. My component has backing java. I tried to modify "head" in encodeBegins() method, but my child is not rendered at all. Take a look at the implementation: @FacesComponent(value = "com.ramps.util.ThemeSelector") public class

JSF template: rendered page missing DOCTYPE

天涯浪子 提交于 2019-11-30 18:33:45
问题 TL;DR: I can't get the DOCTYPE header to appear on my JSF pages. I just inherited a JSF 1.2 project that's having some display issues under IE. I'm brand new to JSF, but I think the issues stem from the fact that the rendered pages (from "view source") do not contain a proper DOCTYPE . The pages are composed of multiple parts, brought together using several layers of <ui:composition> . A typical page will look like: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE composition PUBLIC "-//W3C/

Common Facelets files in shared library JAR outside /WEB-INF/lib

纵然是瞬间 提交于 2019-11-30 18:11:19
问题 I have a common shared Library (that is setup as a Shared Library in Websphere Application server). The folder structure of that jar is: UtilityJAR ----src -com -test -TestClass.java ---- META-INF -resources -template.xhtml -css -style.css In my web Project, I have a template client file called User.xhtml that uses the template file from the above Shared Library using ui:composition template="/template.xhtml" When I have the above jar file in the WEB-INF/lib folder of the Web application, the

Partial page update when navigating (PrimeFaces ajax)

隐身守侯 提交于 2019-11-30 16:36:44
I have done a basic JSF app, using facelets templates. My template is as follows: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:head> <!-- Links to CSS stylesheets... --> <title><ui:insert name="title" /> - FManager</title> </h:head> <h:body> <div id="wrapper"> <div id="header"> <b>FManager</b> Application </div> <div id="content"> <p:growl id="growl" /> <ui:insert name="content"> Sample content. </ui:insert> </div> </div> <div id="footer">Made using JSF and