How to use JSF versioning for resources in jar

That’s unfortunately not possible. Library versioning is not supported for resources in JAR. You’ve basically 2 options: Do it the easy and ugly way, include server’s startup time as query string. Given that you’re using OmniFaces, you could use its builtin #{startup} managed bean referring a java.util.Date instance in application scope: <h:outputStylesheet … name=”some.css?#{startup.time}” /> … Read more

When to use f:view and f:subview

<f:view> The <f:view> is only useful if you want to explicitly specify/override any of the available attributes such as locale, encoding, contentType, etc or want to attach some phase listeners. E.g. <f:view locale=”#{user.locale}” encoding=”UTF-8″ contentType=”text/html”> If you don’t specify it, then the sane JSF defaults will just be used instead, which is respectively UIViewRoot#getLocale(), UTF-8 … Read more

Passing the backing bean as a parameter to a Facelet include

You can use <ui:param> for that. It needs to be nested in the <ui:include>. <ui:include src=”https://stackoverflow.com/questions/16842912/formView.xhtml”> <ui:param name=”ParameterBean” value=”#{Bean}” /> </ui:include> Unrelated to the concrete problem, standard Java Naming Conventions state that instance variable names must start with lower case. You should change your code in such way that respectively parameterBean and #{bean} will be … Read more

Update component after file download

p:commandButton in your case is (an has to be) non-AJAX button (you set this by adding ajax=”false” attribute). In that case update attribute and p:ajax tag doesn’t have any sense (as they are only for AJAX requests). When you have file download your application sends streaming of some type, and you see Save File dialog. … Read more

CDI Injection into a FacesConverter

Replace @FacesConverter(value = “categoryConverter”) by @Named and use <h:inputSomething converter=”#{categoryConverter}” /> or <f:converter binding=”#{categoryConverter}” /> instead of <h:inputSomething converter=”categoryConverter” /> or <f:converter converterId=”categoryConverter” /> By the way, similar problem exist for @EJB inside a @FacesConverter. It however offers a way to be grabbed by JNDI manually. See also Communication in JSF 2.0 – Getting an … Read more

JSF facelets template packaging

Facelets compositions (so, just plain *.xhtml pages, templates and include files) are resolved by ExternalContext#getResource() which delegates to ServletContext#getResource(). This requires a Servlet 3.x compatible container because /WEB-INF/lib/*.jar!/META-INF/resources resolving from is new since Servlet 3.0. If you aren’t on Servlet 3.x yet, or want to put those JARs on a different location for some reason, … Read more

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