Input fields hold previous values only if validation failed

This problem is in JSF 2 also recognized and explained in detail in the following answer: How can I populate a text field using PrimeFaces AJAX after validation errors occur? If you were using JSF 2, you could have used OmniFaces’ ResetInputAjaxActionListener or PrimeFaces’ <p:resetInput> or resetValues=”true” for this. To the point, you need to … Read more

Concatenate strings in JSF/JSP EL and Javascript [duplicate]

Assuming you are using Facelets, here’s a relatively good solution: create functions.taglib.xml in your WEB-INF add a context param indicating the location: <context-param> <param-name>facelets.LIBRARIES</param-name> <param-value> /WEB-INF/functions.taglib.xml </param-value> </context-param> In the xml put the following: <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE facelet-taglib PUBLIC “-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN” “https://facelets.dev.java.net/source/browse/*checkout*/facelets/src/etc/facelet-taglib_1_0.dtd”> <facelet-taglib xmlns=”http://java.sun.com/JSF/Facelet”> <namespace>http://yournamespace.com/fnc</namespace> <function> <function-name>concat</function-name> <function-class>com.yourpackage.utils.Functions</function-class> <function-signature> java.lang.String … Read more

How to create a composite component for a datatable column?

The <my:mycolumn> element must be an instance of UIColumn as that’s the only valid child of a UIData component during the render response phase. All other UIComponent types will be ignored, thus not rendered. A composite component is implicitly a UINamingContaner component, which isn’t a UIColumn and therefore ignored. A PrimeFaces <p:dataTable> with a backing … Read more

How to invalidate an user session when he logs twice with the same credentials

The DB-independent approach would be to let the User have a static Map<User, HttpSession> variable and implement HttpSessionBindingListener (and Object#equals() and Object#hashCode()). This way your webapp will still function after an unforeseen crash which may cause that the DB values don’t get updated (you can of course create a ServletContextListener which resets the DB on … Read more