jsf-2

selectBooleanCheckbox value doesn't set properly inside ui:repeat

纵饮孤独 提交于 2019-12-22 17:50:47
问题 i have a ui repeat on a composite as follows: -the ui repeat: <ui:repeat var="award" value="#{myBean.awards}" varStatus="status"> <mycomp:Award id="awardComp" value="#{award}" index="#{status.index}"></mycomp:Award> </ui:repeat> -the composite <h:panelGroup id="cashRow" layout="block" style="height:30px"> <label id="anniversaryAwardCash" class="admin checkbox" style="float: left; clear: both; margin-top: 10px; width: 100px;"> <h:selectBooleanCheckbox value="#{cc.attrs.value.cash}" style=

JSF 2: Cannot choose default entry in dropdown element when dropdown is required and default entry is null

守給你的承諾、 提交于 2019-12-22 17:48:38
问题 I have the following JSF 2 code: <p:selectOneMenu id="dropdown" value="#{data.selection}" required="true" converter="selectOneMenuConverter"> <f:selectItem itemLabel="Select one..." itemValue="" noSelectionOption="true" /> <f:selectItems value="#{data.entries}" var="entry" itemLabel="#{entry.name}" itemValue="#{entry}" /> <p:ajax update="display" event="change" /> </p:selectOneMenu> <h:panelGroup id="display"> <h:outputText value="#{data.selection}" /> </h:panelGroup> Everything works as

Problem with @ViewScope and the @PostConstruct [duplicate]

陌路散爱 提交于 2019-12-22 17:44:08
问题 This question already has an answer here : @ViewScoped calls @PostConstruct on every postback request (1 answer) Closed 3 years ago . My MBean is @ViewScope and the @PostConstruct is called when new instance is created and when made ajax request. this should happen? 回答1: This behavior is a bug in JSF that will be fixed only in the (upcoming) version 2.2 of mojarra. See the detailed answer here: stackoverflow.com/questions/8804317/... 回答2: @ViewScope beans have problems with some tags. for

h:dataTable always displays one row; won't display zero rows

假如想象 提交于 2019-12-22 16:43:11
问题 I'm working in a legacy JSF web app, and my h:dataTable element is giving me trouble. Normally, it displays exactly how I want it - a header and several rows, all with proper padding and margins and everything. However, if I try to display a table with zero rows (which is a valid use case for me), JSF still renders one row, albeit empty of contents. Here's the source code for this h:dataTable: <h:dataTable styleClass="table" value="#{backingBean.emptyList}" var="result"> <h:column> <f:facet

JSF 2.0 + Primefaces 2.x: Bind string to calendar

不问归期 提交于 2019-12-22 16:30:45
问题 I have a bean which contains a field of type java.lang.String . This field holds free-form text which can represent a number, string, or date. When the field represents a date, I render a calendar (primefaces) on the screen, otherwise an input box is rendered. The problem I'm having is that after the user selects the date via the calendar, I would like the date string that gets written to my free-form field to have a specific format (MM/dd/yyyy). Currently the string that gets set has the

JSF: why is empty test in rendered invoked during apply request values phase during form submission under request scoped POST REDIRECT GET

我是研究僧i 提交于 2019-12-22 16:30:45
问题 This question is spawned from the partial answer to JSF2: why does empty test in rendered of panelGroup in composite prevent action from being called? In the following an Element is an @Entity with a name and id. A view.xhtml JSF page takes the id as a viewParam and uses setID(Long id) of the @ManagedBean @RequestScoped ElementController to trigger loading of the corresponding Element by id from database (that plays no further role in the question) and this found Element is set as the

JSF 2.0 + Primefaces 2.x: Bind string to calendar

和自甴很熟 提交于 2019-12-22 16:30:17
问题 I have a bean which contains a field of type java.lang.String . This field holds free-form text which can represent a number, string, or date. When the field represents a date, I render a calendar (primefaces) on the screen, otherwise an input box is rendered. The problem I'm having is that after the user selects the date via the calendar, I would like the date string that gets written to my free-form field to have a specific format (MM/dd/yyyy). Currently the string that gets set has the

JSF no redirect request after file input ajax

巧了我就是萌 提交于 2019-12-22 14:16:04
问题 I have a form in JSF 2.2: <h:form enctype="multipart/form-data"> <h:outputLabel>title *</h:outputLabel> <h:inputText value="#{bean.title}" required="" /> <h:outputLabel>Image *</h:outputLabel> <h:inputFile value="#{bean.picutreFile}" a:accept="image/*"> <f:ajax listener="#{bean.uploadPicture}" /> </h:inputFile> <h:commandLink action="#{bean.save}"> Save </h:commandLink> </h:form> The functions: public String save() { return "/index?faces-redirect=true"; } public void uploadPicture() { // Do

How can I conditionally render .js file in h:head, if file was not rendered after Full Page Refresh (FPR)?

做~自己de王妃 提交于 2019-12-22 14:15:06
问题 PrimeFaces conditionally renders the following in h:head: <script type="text/javascript" src="/webapp/javax.faces.resource/push/push.js.jsf?ln=primefaces"><!--//--></script> when PrimeFaces p:socket component is added to JSF/xhtml page. Some of my page refreshes, result in this push.js file 'not' being rendered in h:head. When push.js file is 'not' rendered, I would like to conditionally render the push.js file in attempt to fix/workaround an issue I'm having with PrimeFaces Push. For more

How to pass dynamic parameter to backing bean using EL 2.2 method expression? [duplicate]

我的梦境 提交于 2019-12-22 14:03:19
问题 This question already has answers here : Invoke direct methods or methods with arguments / variables / parameters in EL (2 answers) Closed 3 years ago . I'm trying to call a function from a JSF 2.0 page in my backing bean passing a dynamic parameter. It works fine as long as im passing a static string, but when I try using a dynamic one, I always get an EL parsing error. I guess its a syntax problem, but I can't think of another way to do this using method expression. I know that I could do