com.sun.faces.numberOfViewsInSession vs com.sun.faces.numberOfLogicalViews

First of all, the Mojarra implementation unintentionally swapped the meaning of those context parameters. So if you have the impression that the description is exactly the other way round than what the literal context parameter name implies, then this is indeed true. com.sun.faces.numberOfLogicalViews This is basically GET request based. Every GET request creates a new … Read more

DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled.

just add this attribute rowKey to the datatable tag : <p:dataTable border=”1″ value=”#{projectAdminisrationMB.projectNoUsersList}” var=”userObj” rowKey=”#{userObj.name}”selection=”#{projectAdminisrationMB.selectedUsers}” selectionMode=”multiple” rowIndexVar=”rowIndex” binding=”#{table2}”>

Basic Security in JSF

There is no inherent authentication functionality in core JSF beyond being able to use things like component rendered attributes geared towards role-based security. By default, a JSF application relies on the same container-managed security mechanisms as the web component that contains it (JEE5 tutorial). 3rd party frameworks like Seam can provide alternatives. If you want … Read more

How to install and use CDI on Tomcat?

Tomcat as being a barebones JSP/Servlet container doesn’t support CDI out the box. It is not correct to drop jakartaee-api.jar or javaee-api.jar in /WEB-INF/lib just to get your code to compile. The JEE API JAR contains solely the API classes, not the concrete implementation. Get rid of the whole JAR. It can cause many other … Read more

Updating entire on complete of

The rowEdit and cellEdit events does by design inside the table not update/re-render anything else than the current row, even not when explicitly specified in update attribute. It’s the consequence of PrimeFaces’ a bit overzealous attempt to minimize the response size. This makes sense in most of the cases, but not in specifically your case. … Read more

How do I process GET query string URL parameters in backing bean on page load?

Yes, you can use the <f:viewParam> to set a request parameter as a managed bean property. <f:metadata> <f:viewParam name=”companyId” value=”#{bean.companyId}” /> </f:metadata> You can if necessary invoke a bean action using <f:viewAction> (JSF 2.2+ only) or <f:event type=”preRenderView”>. <f:metadata> <f:viewParam name=”companyId” value=”#{bean.companyId}” /> <f:viewAction action=”#{bean.onload}” /> </f:metadata> When using <f:viewAction> you can even return a … Read more

Execution order of events when pressing PrimeFaces p:commandButton

It failed because you used ajax=”false”. This fires a full synchronous request which in turn causes a full page reload, causing the oncomplete to be never fired (note that all other ajax-related attributes like process, onstart, onsuccess, onerror and update are also never fired). That it worked when you removed actionListener is also impossible. It … Read more

instanceof check in EL expression language

You could compare Class#getName() or, maybe better, Class#getSimpleName() to a String. <h:link rendered=”#{model[‘class’].simpleName eq ‘ClassA’}”> #{errorMessage1} </h:link> <h:link rendered=”#{model[‘class’].simpleName eq ‘ClassB’}”> #{errorMessage2} </h:link> Note the importance of specifying Object#getClass() with brace notation [‘class’] because class is a reserved Java literal which would otherwise throw an EL exception in EL 2.2+. The type safe alternative is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)