jsf-2.2

Why are expired @ViewScoped beans not destroyed until the session expires

回眸只為那壹抹淺笑 提交于 2019-11-28 01:08:27
I'm using Mojarra 2.2.4 on GlassFish 4 with Java 7. As I understand from BalusC's answer to How and when is a @ViewScoped bean destroyed in JSF? , @ViewScoped beans should be destroyed in three cases: Post-back with non-null outcome Session expiration Maximum number of logical views in session exceeded My beans are being destroyed in the first two cases, but not when the maximum number of logical views is exceeded. I have verified that the beans do expire when the maximum is exceeded (I get a ViewExpiredException), but they are still not destroyed until the session itself expires. For memory

Tomcat 8 (and 9) coerce behaviour, null strings are incorrectly set as empty strings

ⅰ亾dé卋堺 提交于 2019-11-28 00:11:24
I have just migrated to Tomcat 8. I used to work with system property org.apache.el.parser.COERCE_TO_ZERO=false so empty strings, numbers, booleans etc. are treated as null . In Tomcat 8, EL 3.0, it is supposed to be the default but it is in fact converting null string to empty string "" on JSF side. It is supposed to be a bug and it is supposed to be corrected but I'm not able to get it working in TomEE snapshot (Tomcat 8.0.27.0, MyFaces 2.2.8). BalusC This is a bug in the EL 3.0 specification. Since EL 3.0, as consequence of overzealous fix of JSP spec issue 184 , null will be coerced back

JSF 2.2 Memory Consumption: Why does Mojarra keep the ViewScoped Beans of the last 25 Views in Memory?

二次信任 提交于 2019-11-27 21:12:53
Memory per Session grows We are experiencing high memory consumption using JSF 2.2 (2.2.12) with Mojarra. After investigating our load tests it turned out that the size of the data in our ViewScoped Beans is quite high (sometimes more than 1MB). Anyway - when navigation from view to view, the session memory size grows and grows. We can't decrease the size of the beans on short-term, so this behavior has quite some impact. Solution 1 - Changing Context Params (not working) Now - we played around with the offical context parameter from Mojarra which are set to 15 by default: com.sun.faces

f:viewParam doesn't pass required parameter when new xmlns.jcp.org namespace is used

萝らか妹 提交于 2019-11-27 15:47:58
I am trying to use Glassfish 4.0 with Java EE 7 XML namespaces to test the sample below. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core"> <h:head> <title>Title</title> </h:head> <h:body> <h:form> <ul> <ui:repeat value="#{appLoad.movieList}" var="movie"> <li> <h:link value="#{movie.title}" outcome="movie" includeViewParams="true"> <f:param name="id" value="#{movie.id}"/> </h:link> </li> </ui:repeat> </ul> </h:form> </h:body> </html> It links to the following page movie.xhtml :

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

女生的网名这么多〃 提交于 2019-11-27 15:31:26
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 that country should be populated in its menu in that current row. How to load such lists of states that

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

筅森魡賤 提交于 2019-11-27 15:08:48
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) { System.out.println("something changed"); } } Adding multiple f:ajax elements doesn't seem to work

When to use preRenderView versus viewAction?

▼魔方 西西 提交于 2019-11-27 14:44:31
问题 When should one use the preRenderView event to initialize data for a page versus using the viewAction? Are they equal in use and do they have the same effect? preRenderView Event <f:metadata> <f:event type="preRenderView" listener="#{myBean.initialize}"/> </f:metadata> or viewAction <f:metadata> <f:viewAction action="#{myBean.initialize}"/> </f:metadata> 回答1: In practice, they can be used to achieve the same effect, but viewAction (new with JSF2.2) comes with the following enhancements:

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

送分小仙女□ 提交于 2019-11-27 14:31:29
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(FaceletViewHandlingStrategy.java:237) at com.sun.faces.application.ApplicationImpl.createComponent

Target Unreachable, identifier resolved to null in JSF 2.2 [duplicate]

醉酒当歌 提交于 2019-11-27 13:00:57
问题 This question already has an answer here: Identifying and solving javax.el.PropertyNotFoundException: Target Unreachable 14 answers I have a problem with JSF 2.2 and CDI, my managerbean is not solved and this error appear "value="#{userBean.user.name}": Target Unreachable, identifier 'userBean' resolved to null" This is my manager bean. @ManagedBean @RequestScoped public class UserBean implements Serializable { private User user; public void setUser(user) { this.user = user; } ... } My view

Process f:viewParam only on page load

馋奶兔 提交于 2019-11-27 09:22:36
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 when doing ajaxical postbacks using components like <p:commandButton> , <p:commandLink> which is