I'm new in using primefaces(PF 3.2) and i've got a problem , I'm sure that is very simple for you.
First sorry for my bad english
I wanna that every time that an user click on update button (general or single row button) a variable (that i called "id" ) increases. Is it possible?
I implement, in my xhtml page, the fileupload component
Code: Select all
<p:fileUpload widgetVar="up" fileUploadListener="#{uploadBean.handleFileUpload}"
mode="advanced"
update="messages"
multiple="true"
sizeLimit="100000"
allowTypes="/(\.|\/)(gif|jpe?g|pdf)$/"
oncomplete="#{uploadBean.inc()}" />
and the bean (SessionScoped) :
Code: Select all
public class UploadBean implements Serializable{
private long id=0;
public void inc(){
id++;
System.out.println("increase id : "+id);
}
public void handleFileUpload(FileUploadEvent event) {
FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
But this code increase the variable when i load the page ,two times, and not when i press the upload button..
Can anybody help me?
ig89