jsf-2.2

Populate p:selectOneMenu based on another p:selectOneMenu in each row of a p:dataTable

你。 提交于 2019-11-26 17:14:43
问题 I have a <p:dataTable> with lazy load. In two of the columns, there is a <p:selectOneMenu> in each of them. The first column holds a list of countries and the second one holds a list of states from a database. I want the second menu (the one that contains a list of states) to show only those states in each row of the data table which correspond to the country in the first menu in each row of the data table. During edit mode, when a country in its menu is changed, the states corresponding to

Execute JavaScript before and after the f:ajax listener is invoked

我们两清 提交于 2019-11-26 16:54:06
问题 It there an easy way to invoke a JavaScript action before and after the invocation of an <f:ajax listener> , e.g. I'd like to invoke window.alert("pre") before and window.alert("post") after onChange is invoked in the backing bean ACtrl : <h:form> <h:inputText id="anId" value="#{cityCtrl.dbHost}"> <f:ajax event="change" listener="#{aCtrl.onChange}" execute="@all"/> </h:inputText> </h:form> @ManagedBean public class ACtrlimplements Serializable { public void onChange(AjaxBehaviorEvent event) {

Using new xmlns.jcp.org namespace on composites causes java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.putIfAbsent

只愿长相守 提交于 2019-11-26 16:47:09
问题 I am reading The Java EE 7 Tutorial from http://docs.oracle.com/javaee/7/tutorial/doc/jsf-facelets005.htm#GIQZR After I typed the example code in the chapter 8.5 Composite Components in my IDE and run the example on GlassFish4.0, I got an error java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:1078) at com.sun.faces.util.Cache.get(Cache.java:116) at com.sun.faces.application.view.FaceletViewHandlingStrategy.getComponentMetadata

Exception handling in JSF ajax requests

♀尐吖头ヾ 提交于 2019-11-26 15:27:20
How do I handle the exception and access the stack trace when an exception is thrown while processing a JSF ajax request? Right now, I only get the exception class name and message in a JavaScript alert when JSF project stage is set to Development. Even worse, there's no visual feedback whatsoever when JSF project stage is set to Production, and the server log doesn't show any information about the exception. If that's relevant, I'm using GlassFish in Netbeans. BalusC This problem is known and fleshed out in among others the OmniFaces FullAjaxExceptionHandler showcase . Basically, you need to

Process f:viewParam only on page load

喜你入骨 提交于 2019-11-26 14:42:35
问题 I'm using an <f:viewParam> to pass a parameter as follows. <ui:define name="metaData"> <f:metadata> <f:viewParam name="id" value="#{bean.entity}" converter="#{converter}"/> </f:metadata> </ui:define> Is it possible to process this <f:viewParam> , only when the page is loaded/refreshed? It is just because the converter as specified with the <f:viewParam> is costly that converts the value passed through the query-string to a JPA entity. Hence, it involves an expensive database transaction, even

File upload doesn&#39;t work with AJAX in PrimeFaces 4.0/JSF 2.2.x - javax.servlet.ServletException: The request content-type is not a multipart/form-data

痴心易碎 提交于 2019-11-26 14:24:31
Important : The issue which is discussed in this thread has been fixed as of PrimeFaces 5.1 final (community release) released on Monday, October 6, 2014 (just a few minutes ago from now). I attempted on JSF 2.2.8-02 (or api , impl ). As such, if you happened to use that version ( or higher, no need to mention ), you would not even need to read this question anymore. I have a web application running on GlassFish 4.0 Mojarra 2.2.4 PrimeFaces 4.0 final Everything except file upload with AJAX works well. The following xhtml file sends multipart contents via an AJAX request triggered by a

@ViewScoped bean recreated on every postback request when using JSF 2.2

China☆狼群 提交于 2019-11-26 13:46:57
I'm having an issue similar to this post and the answer from @BalusC with 3 solutions but: I'm not using of the mentioned EL expressions I don't want to go with the second solution (it's complex enough for me like this) and partial state saving is set to false. My code is as follows: index.xhtml : <?xml version="1.0" encoding="windows-1256" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun

Getting ViewExpiredException in clustered environment while state saving method is set to client and user session is valid

风格不统一 提交于 2019-11-26 11:24:54
问题 I have a JSF application that uses Mojarra 2.2.9 and is deployed on WebSphere 8.5.5.4 on clustered environement and javax.faces.STATE_SAVING_METHOD is set to client . Even though all my application beans are request scoped, sometimes when the user session is valid and the user is doing post request on a page he gets ViewExpiredException . What may be causing this issue and how can I solve it? Will changing the javax.faces.STATE_SAVING_METHOD to server solve it? If so, what is the impact of

Pass an object between @ViewScoped beans without using GET params

情到浓时终转凉″ 提交于 2019-11-26 10:29:25
I have a browse.xhtml where I browse a list of cars and I want to view the details of the car in details.xhtml when a "View more" button is pressed. Their backing beans are @ViewScoped and are called BrowseBean and DetailsBean , respectively. Now, I wouldn't like the user/client to see the car ID in the URL, so I would like to avoid using GET params, as presented here and here . Is there any way to achieve this? I'm using Mojarra 2.2.8 with PrimeFaces 5 and OmniFaces 1.8.1. BalusC Depends on whether you're sending a redirect or merely navigating. If you're sending a redirect, then put it in

Fileupload and PrettyFaces and JSF 2.2 [duplicate]

六眼飞鱼酱① 提交于 2019-11-26 09:57:52
问题 This question already has an answer here: Primefaces FileUpload with PrettyFaces and JSF 2.2.3 3 answers I\'ve tried the solution from: Primefaces FileUpload with PrettyFaces and JSF 2.2.3 But it doesn\'t work for a few files (tested under tomcat 7.0.50). One of the files is: http://ftp.carnet.hr/misc/apache//xerces/j/source/Xerces-J-src.2.11.0-xml-schema-1.1-beta.zip Has someone a better solution for this problem (other than removing the urlmapping)? EDIT: There is no error/exception thrown!