Primefaces valueChangeListener or

If you want to use valueChangeListener, you need to submit the form every time a new option is chosen. Something like this: <p:selectOneMenu value=”#{mymb.employee}” onchange=”submit()” valueChangeListener=”#{mymb.handleChange}” > <f:selectItems value=”#{mymb.employeesList}” var=”emp” itemLabel=”#{emp.employeeName}” itemValue=”#{emp.employeeID}” /> </p:selectOneMenu> public void handleChange(ValueChangeEvent event){ System.out.println(“New value: ” + event.getNewValue()); } Or else, if you want to use <p:ajax>, it should look … Read more

How to use java.time.ZonedDateTime / LocalDateTime in p:calendar

Your concrete problem is that you migrated from Joda’s zoneless date time instance DateTime to Java8’s zoned date time instance ZonedDateTime instead of Java8’s zoneless date time instance LocalDateTime. Using ZonedDateTime (or OffsetDateTime) instead of LocalDateTime requires at least 2 additional changes: Do not force a time zone (offset) during date time conversion. Instead, the … Read more

List of events

You might want to look at “JavaScript HTML DOM Events” for a general overview of events: http://www.w3schools.com/jsref/dom_obj_event.asp PrimeFaces is built on jQuery, so here’s jQuery’s “Events” documentation: http://api.jquery.com/category/events/ http://api.jquery.com/category/events/form-events/ http://api.jquery.com/category/events/keyboard-events/ http://api.jquery.com/category/events/mouse-events/ http://api.jquery.com/category/events/browser-events/ Below, I’ve listed some of the more common events, with comments about where they can be used (taken from jQuery documentation). Mouse Events … Read more

Override a method from a Primefaces specific widget

Tested with one of my tables: PF(‘myTable’).showCellEditor = function() { console.log(‘my function’) } Don’t forget to call the generic implementation if you need to: PF(‘myTable’).showCellEditor = function() { console.log(‘my function’) // call the generic implementation: PrimeFaces.widget.DataTable.prototype.showCellEditor.call(this); } See also: Calling method using JavaScript prototype Intro to Primefaces widgetvar

Reset input fields without executing validation

The <p:commandButton> processes indeed by default the entire form (process=”@form”), you can change this by specifying only the current component in the process attribute. <p:commandButton value=”Reset” … process=”@this” /> However, this will fail if the form is already been validated beforehand. The input fields which have been marked invalid won’t be updated with the new … 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