jsf-2

Managed Bean as Facelet parameter lets composite component prevent resolving

荒凉一梦 提交于 2019-12-23 10:55:19
问题 In the given case, I want to use a facelet with different ManagedBeans, so the regarding action-bean is given as an parameter: <?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:body> <ui:include src="ratings.xhtml" > <ui:param name="createAction" value="

JSF updating a composite component

做~自己de王妃 提交于 2019-12-23 10:54:33
问题 Is it possible to update child components of a composite component just by specifying the parent composite ID? E.g. if I have: <composite:interface> <composite:attribute name="value" type="..." required="true"/> </composite:interface> <composite:implementation> <p:treeTable id="main-tree" ...> ... </p:treeTable> </composite:implementation> and to use it somehow like this: <my:comp id="composite-component" /> ... <p:ajax update="composite-component" /> Is that possible? Right now the only way

Can't get PrimeFaces RequestContext.getCurrentInstance().openDialog() to work

烈酒焚心 提交于 2019-12-23 10:52:41
问题 Can't get PrimeFaces RequestContext.getCurrentInstance().openDialog() to work. I lifted the example code right out of the primefaces showcase, but I never get a dialog to open up. I'm using PF 5.1 running on Wildfly 8.2.0.Final. Any ideas what's up? DFView.java @ManagedBean(name = "dfView") public class DFView { public void chooseCar() { RequestContext.getCurrentInstance().openDialog("selectCar"); } public void onCarChosen(SelectEvent event) { Car car = (Car) event.getObject(); FacesMessage

IF-ELSE condition in JSF form. Need to know right approach

本秂侑毒 提交于 2019-12-23 10:44:29
问题 There is if-else condition on my form where I show heading and button text for add and update. Below code what I have used in struts2 project and same code want to use in JSF2 project in xhtml page. Struts2 Page <s:if test="person==null || person.id==null || person.id==''"> <s:set var="buttonText" value="getText('person.button.add')"/> <s:text name="person.h1.add.text"/> <i><s:text name="person.smallfont.add.text"/></i> </s:if> <s:else> <s:set var="buttonText" value="getText('person.button

JSF Named Bean, Eager application scoped (aka @ManagedBean(eager=true) )

断了今生、忘了曾经 提交于 2019-12-23 10:09:30
问题 Is there any way to initialize Named Bean annotaded by javax.inject.Named / javax.enterprise.context.ApplicationScoped like @ManagedBean(eager=true) from javax.faces package? @Named @ApplicationScoped public Mail() { ... } I want to load this class when application starts, not when webapplication refers to this bean. ps. JSF 2.1 Bean Injected by Glassfish 3.1 回答1: You can create a CDI extension that has the @Observes AfterBeanDiscovery parameter on one of his methods. There you can

Different facelets (for use in templates) in JSF 2 per locale

社会主义新天地 提交于 2019-12-23 09:34:50
问题 I have a template somewhere that has <ui:insert name="help_contents" /> and a page that defines <ui:define name="help_contents><!-- actual contents --></ui:define> , where the contents in the definition should be JSF-based (not just plain html/xhtml), handled by the faces servlet and differing based on locale. But I don't want to do this with resource bundles, since that would require large swathes of text per property and having to break it up for every component that's interspersed with the

Immediate=true VS immediate=false in JSF Component

折月煮酒 提交于 2019-12-23 07:52:44
问题 I was reading Core JavaServer Faces and I was working on Event Handling. It says that if immediate=true for a component(lets say for a button), when we click that button, the process validation, and invoke application faces of the JSF life cycle will be done early. What does it mean? Can any body explain to me what the immediate=true will affect in each phases? I am confused. Thank you. 回答1: The following link most clearly demonstrates the JSF Lifecycle Phases, How to Debug them, and how

Immediate=true VS immediate=false in JSF Component

梦想的初衷 提交于 2019-12-23 07:52:30
问题 I was reading Core JavaServer Faces and I was working on Event Handling. It says that if immediate=true for a component(lets say for a button), when we click that button, the process validation, and invoke application faces of the JSF life cycle will be done early. What does it mean? Can any body explain to me what the immediate=true will affect in each phases? I am confused. Thank you. 回答1: The following link most clearly demonstrates the JSF Lifecycle Phases, How to Debug them, and how

JSF 2.0 Update a primefaces dialog not working the first time

回眸只為那壹抹淺笑 提交于 2019-12-23 07:33:03
问题 I have a simple form that asks the user to input a text. Then when the user clicks the link, a dialog is showed with the value entered by the user. The first issue I have is that the dialog does not show. The other issue concerns the update. When the form is displayed for the first time, the HTML code is correct and the current value of #{dialogBean.location} is empty. Then I click on the link, the HTML code is "wrong". That's why I guess it does not show: <form id="dialogForm" name=

JSF 2.0 Update a primefaces dialog not working the first time

被刻印的时光 ゝ 提交于 2019-12-23 07:32:22
问题 I have a simple form that asks the user to input a text. Then when the user clicks the link, a dialog is showed with the value entered by the user. The first issue I have is that the dialog does not show. The other issue concerns the update. When the form is displayed for the first time, the HTML code is correct and the current value of #{dialogBean.location} is empty. Then I click on the link, the HTML code is "wrong". That's why I guess it does not show: <form id="dialogForm" name=