How to find indication of a Validation error (required=”true”) while doing ajax command

Not specifically for required=”true”, but you can check by #{facesContext.validationFailed} if validation has failed in general. If you combine this with checking if the button in question is pressed by #{not empty param[buttonClientId]}, then you can put it together in the rendered attribute of the <h:outputScript> as follows: <h:commandButton id=”add_something_id” binding=”#{add}” value=”Add” action=”#{myBean.addSomething(false)}”> <f:ajax execute=”@form” … Read more

Invoke method with varargs in EL throws java.lang.IllegalArgumentException: wrong number of arguments

No, it is not possible to use variable arguments in EL method expressions, let alone EL functions. Your best bet is to create multiple different named methods with a different amount of fixed arguments. public static boolean isValueIn2(Integer value, Integer option1, Integer option2) {} public static boolean isValueIn3(Integer value, Integer option1, Integer option2, Integer option3) … Read more

Is JSF 2.0 View Scope back-button safe?

To start, the view scope is bound to a particular page/view. Multiple views won’t share the same view scoped bean. The view scope starts with an initial GET request and stops when a POST action navigates with a non-null return value. There are in general the following scenarios, depending on whether the browser is instructed … Read more


This is not Mojarra specific. This is Tomcat specific (JBoss uses Tomcat as servletcontainer). Add the following VM argument to startup options. -Dorg.apache.el.parser.COERCE_TO_ZERO=false To my experience, this one should actually only apply on Number properties (int, long, etc), however since a certain late Tomcat 6.0.x version (at least after 6.0.20) it seems to be broken … Read more

How to get rid of WARNING: PWC4011: Unable to set request character encoding to UTF-8

JSF/Facelets uses by default UTF-8 to decode HTTP request parameters. GlassFish itself uses by default ISO-8859-1 do decode HTTP request parameters. HTTP request parameters can be parsed and decoded only once and this happens whenever a request parameter is requested by the code for the first time like so request.getParameter(“name”). So, if a request parameter … Read more

JSF implicit vs. explicit navigation

This is somewhat subjective, but ala, it boils down to the following: Navigation rules in XML are a maintenance hell. Using navigation rules suggests that the web application in question suffers from the “one URL behind” problem which causes bad user experience (pages are not bookmarkable). Using navigation rules suggests that the web application in … Read more

Should PARTIAL_STATE_SAVING be set to false?

Should PARTIAL_STATE_SAVING be set to false? Only when you encounter a general defect related to partial state saving in your webapp which can really not be solved/workarounded the other way. Partial state saving has namely major advantages as to overall performance and memory usage. See also Why JSF saves the state of UI components on … Read more