h:inputText data cached - jsf

Click "LINK1" --> modal popsup --> enter value in text-box --> click Submit/Process
Click another link "update/cancel" --> same modal popsup --> I see the value in the text box (This is fine and if I reload the page and click the link again, the modal appears with values intact)
Click "LINK1" --> same modal popsup --> I see the value in the text box cached(this time I want the values not to be cached in the text box) --> If I reload the page, the values go away though.
I have tried clearing the backing-bean when the links are clicked, but still the values appear. Please advise.
Update here is the code:
ReimbursementActionBean.java
#Name("reimbursementAction")
#Scope(ScopeType.CONVERSATION)
public class ReimbursementActionBean implements Serializable {
public void initReimbursement(PaymentInfo payment) {
// do something
}
public void initNewReimbursement(PaymentInfo payment) {
initReimbursement(payment);
// --> log.info("CLEARING INPUT ELEMENT CACHE");
// -->this.getReimbursement().setAmount(null);
hideModal = false;
}
public void initUpdateReimbursement(PaymentInfo payment) {
initReimbursement(payment);
hideModal = false;
}
public void initCancelReimbursement(PaymentInfo payment) {
initReimbursement(payment);
hideModal = true;
}
public void reimbursePayment() {
// do something
}
public void updateReimbursment() {
// do something
}
public void cancelReimbursment() {
// do something
}
public void cancelupdateReimbursment() {
hideModal = true;
}
public Reimbursement getReimbursement() {
return reimbursement;
}
public void setReimbursement(Reimbursement reimbursement) {
this.reimbursement = reimbursement;
}
}
reimbursePaymentModal.xhtml
< rich:modalPanel id="reimbursePaymentPanel"
width="430"
autosized="true"
showWhenRendered="#{!hideModal}">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="Reimburse Payment"/>
</h:panelGroup>
</f:facet>
<h:form>
<a4j:outputPanel id="reimbursePaymentDiv">
<s:div styleClass="section" style="padding:5px;padding-left:0px;">
<s:decorate template="/layout/edit.xhtml">
<ui:define name="label">Reimbursement Amount(*)</ui:define>
<h:inputText id="reimbursementAmount"
value="#{reimbursementAction.reimbursement.amount}">
<a4j:support event="onblur" rerender="reimbursementAmount" action="#{reimbursementAction.validateAmount}" limitToList="true" />
</h:inputText>
</s:decorate>
<div style="clear:both"></div>
</s:div>
<div class="button-holder" style="padding-top:10px">
<div style="float:right">
<a4j:commandLink oncomplete="Richfaces.hideModalPanel('reimbursePaymentPanel');"
immediate="true"
action="#{reimbursementAction.cancelupdateReimbursment()}"
styleClass="button"
reRender="reimbursePaymentPanel">
<!--todo add cancel command to reimbursementAction-->
<span class="inner-button">Cancel</span>
</a4j:commandLink>
</div>
<div style="float:right">
<a4j:commandLink id="reimbursePaymentId" styleClass="button"
oncomplete="this.disabled=false;"
action="#{reimbursementAction.reimbursePayment}"
rendered="#{reimbursementAction.reimbursementConstraints.allowableReimbursementAction eq 'SUBMIT_NEW'}"
reRender="paymentSearchResults,reimbursePaymentDiv,reimbursePaymentPanel,pnlInfoView" limitToList="true"
bypassUpdates="true" onclick="this.disabled=true;">
<span class="inner-button">Process</span>
</a4j:commandLink>
</div>
</div>
</a4j:outputPanel>
</h:form>
</rich:modalPanel>
PaymentList.xhtml
< a4j:outputPanel id="paymentSearchResults" ajaxRendered="true">
<s:div styleClass="section" style="overflow-y:scroll; overflow-x:hidden;max-height:420px;margin:10px "
rendered="#{not empty paymentList}">
<rich:dataTable id="paymentListId"
var="payment"
value="#{paymentList}"
styleClass="data-table"
rowClasses="odd,even"
width="100%">
<!-- Reimburse -->
<s:div rendered="#{payment.reimbursementSummary.allowableReimbursementActionType eq 'SUBMIT_NEW'}">
<a4j:commandLink action="#{reimbursementAction.initNewReimbursement(payment)}"
reRender="reimbursePaymentPanel,reimbursePaymentDiv"
limitToList="true">
<span> Reimburse</span>
</a4j:commandLink>
</s:div>
<!-- Update Reimburse and Cancel Reimbursement-->
<s:div rendered="#{payment.reimbursementSummary.allowableReimbursementActionType eq 'MODIFY_EXISTING'}">
<a4j:commandLink action="#{reimbursementAction.initUpdateReimbursement(payment)}"
reRender="reimbursePaymentPanel,reimbursePaymentDiv"
limitToList="true"
bypassUpdates="true">
<span>Update Reimbursement</span>
</a4j:commandLink>
<h:outputText value=" | "/>
<a4j:commandLink oncomplete="Richfaces.showModalPanel('cancelReimbursementPanel');"
action="#{reimbursementAction.initCancelReimbursement(payment)}"
reRender="cancelReimbursementDiv"
limitToList="true">
<span>Cancel Reimbursement</span>
</a4j:commandLink>
</s:div>
</div>
</rich:column>
</rich:dataTable>
</s:div>
</a4j:outputPanel>
The links I am talking about are: Reimburse and Update Reimbursement. Clicking on the links rerender reimbursePaymentPanel which open up the modal with id=reimbursePaymentPanel having textbox with id="reimbursementAmount".

I think you should add in the reRender of your a4j:commandLink the id of the text box that you wanna update, which is "reimbursementAmount":
<a4j:commandLink
action="#reimbursementAction.initNewReimbursement(payment)}"
reRender="reimbursePaymentPanel,reimbursePaymentDiv,**reimbursementAmount**"
limitToList="true">
<span>Reimburse</span>
</a4j:commandLink>
If this didn't work, try to include the modalPanel on the same page, which is "PaymentList.xhtml".
HTH.

Here is what I tried that worked.
reimbursePaymentModal.xhtml
<s:decorate template="/layout/edit.xhtml">
<ui:define name="label">Reimbursement Amount(*)</ui:define>
<h:inputText id="reimbursementAmount"
binding="#{reimburseEvent.amountText}"
value="#{reimbursementAction.reimbursement.amount}">
<a4j:support event="onblur" action="#{reimbursementAction.validateAmount}"
limitToList="true"/>
</h:inputText>
</s:decorate>
PaymentList.xhtml
<s:div rendered="#{payment.reimbursementSummary.allowableReimbursementActionType eq 'SUBMIT_NEW'}">
<a4j:commandLink action="#{reimbursementAction.initNewReimbursement(payment)}"
reRender="reimbursePaymentPanel,reimbursePaymentDiv, reimbursementAmount"
actionListener="#{reimbursementAction.clearForm}" immediate="true" limitToList="true"
>
<span> Reimburse</span>
</a4j:commandLink>
</s:div>
ReimbursementActionBean.java
#In(required=false)
private ReimburseEvent reimburseEvent;
//Added
public void clearForm(ActionEvent event){
if(reimbursement!=null){
reimbursement.setAmount(null);
getReimbursement().setAmount(null);
}
reimburseEvent.getAmountText().setSubmittedValue("");
}
ReimburseEvent.java
#Name("reimburseEvent")
#Scope(ScopeType.EVENT)
#AutoCreate
public class ReimburseEvent {
// amountText is binding attribute in the reimbursementPaymentModal. Binding attributes cannot be used in ReimbursementActionBean (Since it is Conversation Scope).
// So creating ReimburseEvent (Event scope) to support the binding attribute and injecting it to ReimbursementActionBean.
private UIInput amountText;
public void setAmountText(UIInput amountText) {
this.amountText = amountText;
}
public UIInput getAmountText() {
return amountText;
}
}

Related

Cannot successfully update backing bean when not in main page

I am new with JSF/PrimeFacesand now, I'm trying to solve this problem for days.
I have a page with a commandLink which opens a dialog with a TreeTable that displays values from the backing bean. The value of the bean is updated depending on the product.url.
My problem is, I get a successful result when I click on the commandLink from the main page or landing page(/products.xhtml?...ver=2019.000), but when I'm on the other redirected links(/products.xhtml?...ver=2018.000), it just won't work. The passed #{DownloadView.path} is null.
Here's a snippet of my .xhtml with the commandLink:
<div id="features">
<h:form id="form">
<div class="feature-icon fadeInDown animated" style="margin:0px 35px">
<p:commandLink action="/products.xhtml?faces-redirect=true&ver=2019.000" value="2019.000" style="#{fn:startsWith(ProductsView.actVer, '2019.000') ? 'background-color: #e91e63;' : ''}" />
</div>
<div class="feature-icon fadeInDown animated" style="margin:0px 35px">
<p:commandLink action="/products.xhtml?faces-redirect=true&ver=2018.000" value="2018.000" style="#{fn:startsWith(ProductsView.actVer, '2018.000') ? 'background-color: #e91e63;' : ''}" />
</div>
</h:form>
</div>
<div id="promotion" class="clearfix">
. . .
<ui:fragment rendered="#{!empty product.url}">
<ui:fragment rendered="#{fn:startsWith(product.url, 'file')}">
<h:outputText value="#{product.url}"/>
<p:commandLink action="#{DownloadView.listFiles}" update=":download-form:downloadPanel" oncomplete="PF('downloadDialog').show()" title="Details" >
<h:outputText value="#{product.name}" />
<f:setPropertyActionListener target="#{DownloadView.path}" value="#{product.url}" />
</p:commandLink>
</ui:fragment>
</ui:fragment>
. . .
</div>
Here's my dialog:
<h:form id="download-form" >
<p:dialog id="dialog" header="Details" showEffect="fade" widgetVar="downloadDialog" modal="true" resizable="false" dynamic="true">
<p:outputPanel id="downloadPanel">
<p:treeTable value="#{DownloadView.root}" var="download" style="margin-top:0" scrollable="true" scrollHeight="300">
<f:facet name="header">
Document Viewer
</f:facet>
<p:column headerText="Name">
<a href="#{download.path}" > <h:outputText value="#{download.name}" /> </a>
</p:column>
<p:column headerText="Location">
<h:outputText value="#{download.path}" />
</p:column>
</p:treeTable>
</p:outputPanel>
<p:ajax event="open" listener="#{DownloadView.reset()}"/>
</p:dialog>
</h:form>
Here's my DownloadView class:
#SessionScoped
public class DownloadView {
private TreeNode root;
private String path;
private DownloadBI downloadBI;
#PostConstruct
public void init() {
downloadBI = new DownloadBI();
}
public void listFiles() {
downloadBI.setPath(path);
this.root = downloadBI.getFilesTreeNode();
}
public TreeNode getRoot() {
return root;
}
public void setRoot(TreeNode root) {
this.root = root;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public void reset() {
this.path = "";
this.root = null;
}
}
When I click on the commandLink from the landing page, the TreeTable is populated and checking the logs, the path is set:
But, if I click on the commandLink, other than the landing page, the TreeTable is empty and path is not set.
Any idea to resolve this problem is greatly appreciated! Thank you!

primefaces commandlink wont show modal dialog

hello I have a commandLink that executes a method in my baking bean, that method calls an ejb that builds a string and place it as an attribute of the bean (with getters and setters), after executing that method should raise a modal dialog to only display the value of that attribute but it does not, I see the method that builds the chain runs but does not lift the dialogue, this is my code:
xhtml:
<ui:composition>
<p:panelGrid columns="3" style="width: 100%" >
<h:form id="headerForm">
<p:column style="width: 15%;height:auto; text-align: center;">
<p:graphicImage value="#{loginBean.url}" style="align:center;"/>
</p:column>
<p:column>
<div align="center">
<h:outputText styleClass="titleHeader" value="#{loginBean.entityName}" />
</div>
</p:column>
<p:column style="width: 15%;height:auto; text-align: center;">
<div align="right">
<h:commandLink onComplete="PF('dlg').show(); return false;" type="button" ajax="false" action="# {xxxxBean.createString}">
<h:outputText value="Contact" />
</h:commandLink>
</div>
</p:column>
</h:form>
</p:panelGrid>
<p:dialog id="dlg" header="Some title here" widgetVar="dlg" modal="true">
<h:outputText value="#{xxxxBean.stringBuild}" />
</p:dialog>
</ui:composition>
Backing bean:
#ManagedBean
#SuppressWarnings("serial")
public class XxxxBean implements Serializable{
private String stringBuild;
private someBeanRemote ejb;
public XxxxBean() {
// TODO Auto-generated constructor stub
try{
ejb = EjbConsumer.getRemoteEjb();
}catch(Exception e){
e.printStackTrace();
}
}
public void createString(){
List<someObject> list = ejb.findAllActiveObjects(Constants.TOP);
String temp = "";
if( list!=null && list.size() > 0 ){
for(int i=0; i < list.size(); i++){
temp += list.get(i).getName() + "<br/>";
}
this.stringBuild= temp;
}
System.out.println(this.stringBuild);
}
public void setStringBuild(String stringBuild) {
this.stringBuild= stringBuild;
}
public String getStringBuild() {
return stringBuild;
}
}
thanks in advance!!!
You are using ajax=false with oncomplete
oncomplete: Client side callback to execute when ajax request is completed.
Change to:
<p:commandLink oncomplete="PF('dlg').show();" action="#{yourBean.youraction}"></p:commandLink>
that is default ajax = true and everything should work

hide panel with commandbutton

i am using jsf and i am trying to show a hidden panel this what i tried
<h:commandButton update=":outPanel" actionListener="#{SelectBean.mod1()}" image="Ressources/images/update.png" style="vertical-align:middle" >
Modifier
</h:commandButton>
<p:panel visible="#{SelectBean.bol}" closable="true" toggleable="true" id="outPanel" styleClass="outPanel" widgetVar="outpanel">
<h:outputLabel value="Nom " />
<h:inputText value="#{SelectBean.nom}" />
<br/>
<h:outputLabel value="Experience " />
<h:inputText value="#{SelectBean.exp}" />
<br/>
<h:commandButton value="Modifier"/>
</p:panel>
my bean is
private boolean bol=false;
public boolean getBol() {
return bol;
}
public void setBol(boolean bol) {
this.bol = bol;
}
public String mod1()
{
bol = true;
return "success";
}
but this thing not working the panel is always hidden.
Try like this, your panel will be shown if bol is true
<p:panel rendered="#{selectBean.bol}" closable="true" toggleable="true" id="outPanel" styleClass="outPanel" widgetVar="outpanel">
Also i think you have wrong syntax, you should call methods and variables of your class through selectBean but not SelectBean

How to remove a row <h:datatable> programmatically

I have a form like the following picture.
In the above picture you can see a green add button. When I click on it, it create a new row in a datatable via send a <f:ajax> to backing bean and render <h:datatable>.
Until now all thing is good. But i Except when I click on a cross button inside of each row, that row removed. but it have a bug. for example when I click on the third row cross button, it removes this row from backing bean but not from my ui.
in the following you can see my backing bean and .xhtml file.
#ManagedBean(name = "AddPollContorler")
#ViewScoped
public class AddPollControl {
private List<Answer> answers = new ArrayList<Answer>();
#PostConstruct
public void init(){
answers.add(new Answer());
answers.add(new Answer());
}
public List<Answer> getAnswers() {
return answers;
}
public void setAnswers(List<Answer> answers) {
this.answers = answers;
}
public void addAnswer() {
answers.add(new Answer());
}
public void removeAnswer() {
String index=FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("index");
if (StringUtil.isNumber(index))
answers.remove(Integer.parseInt(index));
}
}
.xhtml :
<div class="panel panel-success rgt">
<div class="panel-heading rgt">
<div style="float: left;">
<h:commandLink styleClass="btn btn-success table-button" action="#{AddPollContorler.addAnswer}">
<h:graphicImage library="img" name="add.png" styleClass=" table-icon" />
<f:ajax execute="answers" render="answers"></f:ajax>
</h:commandLink>
</div>
<h4><h:outputText value="#{msg['protected.poll.add.answers']}"/></h4>
</div>
<div class="form-margin">
<h:dataTable value="#{AddPollContorler.answers}" var="answer" id="answers" style="width:100%;">
<h:column >
<div class="input-group poll-answer" style="margin: 5px;">
<span class="input-group-addon no-left-radius"><h:outputText value="#{CounterControler.index+1}" /></span>
<h:inputText value="#{answer.text}" styleClass="form-control no-radius"/>
<div class="input-group-addon no-right-radius poll-answer-remove" >
<h:commandLink action="#{AddPollContorler.removeAnswer}">
<h:graphicImage library="img" name="cross.png" />
<f:param name="index" value="#{CounterControler.last}" />
<f:ajax render="answers answers" />
</h:commandLink>
</div>
</div>
</h:column>
</h:dataTable>
</div>
</div>
update: 2013/06/12
#ManagedBean(name="CounterControler")
public class CounterControl {
private int index=0;
public int getIndex(){
return index++;
}
public int getLast(){
return index-1;
}
}
your code does look pretty good already. How does the CounterControler internally work? (no source given) Alternatives to send the current object might be
to give the object directly as the parameter (you need a fitting converter for that),
give it as direct parameter (action="#{AddPollContorler.removeAnswer(answer)}, works from EL 2.2 on), or
directly get the current object out of the given ActionEvent
The last point would look like
xhtml
<h:commandLink action="#{AddPollContorler.removeAnswer}">
<h:graphicImage library="img" name="cross.png" />
<f:ajax render="answers" />
</h:commandLink>
managed bean
public void removeAnswer(ActionEvent ev) {
Answer selectedItem = null;
try {
UIDataTable objHtmlDataTable = retrieveDataTable(
(UIComponent)ev.getSource());
selectedItem = (Answer) objHtmlDataTable.getRowData();
answers.remove(answer);
} catch (NullPointerException e) {
// somehow couldn't find the element
}
}
private static UIDataTable retrieveDataTable(UIComponent component) {
if (component instanceof UIDataTable) {
return (UIDataTable) component;
}
if (component.getParent() == null) {
return null;
}
return retrieveDataTable(component.getParent());
}
I like that one because it takes most logic out of the frontend. Hope you get your rows cleaned with one of that tactics.
Also, you only need to mention answers once in <f:ajax render="answers" />
EDIT: Even I don't know why - wrapping a <h:panelGroup layout="block" id=" answersWrapper"> around the <h:dataTable> and rendering that panelGroup worked for me.
<h:form id="myForm">
<h:panelGroup id="answerWrapper" layout="block">
<rich:dataTable value="#{myTestBean.answers}" var="answer" id="answers">
<h:column >
<h:outputText value="#{answer}"/>
<h:commandButton id="button" action="#{myTestBean.doTheAction}">
<f:ajax render=":myForm:answerWrapper" />
</h:commandButton>
</h:column>
</rich:dataTable>
</h:panelGroup>
</h:form>

'omnifaces.SelectItemsConverter' converter id is not registered

I'm trying to create a selectManyCheckbox feature in my application, but now I'm in "converter problem". To take care this, I'm trying to use Omnifaces that already have a converter to objects.
My solution is based on this and this question (both answered by BalusC).
Don't know if it helps, but he is my view code:
<h:selectManyCheckbox style="margin-bottom: 40px;" id="disciplinas" value="#{cursoMBean.listaDisciplinasDoCurso}" converter="omnifaces.SelectItemsConverter">
<f:selectItems value="#{cursoMBean.listaTodasDisciplinas}" var="disciplina" itemValue="#{disciplina}" itemLabel="#{disciplina.nome}"/>
</h:selectManyCheckbox>
And my MBean:
private static ArrayList<Disciplina> listaTodasDisciplinas;
private static ArrayList<Disciplina> listaDisciplinasDoCurso;
public ArrayList<Disciplina> getListaTodasDisciplinas() {
return listaTodasDisciplinas;
}
public void setListaTodasDisciplinas(
ArrayList<Disciplina> listaTodasDisciplinas) {
CursoMBean.listaTodasDisciplinas = listaTodasDisciplinas;
}
public ArrayList<Disciplina> getListaDisciplinasDoCurso() {
return listaDisciplinasDoCurso;
}
public void setListaDisciplinasDoCurso(
ArrayList<Disciplina> listaDisciplinasDoCurso) {
CursoMBean.listaDisciplinasDoCurso = listaDisciplinasDoCurso;
}
Disciplina:
public class Disciplina {
private int id;
private String nome;
public Disciplina(int id, String nome) {
this.id = id;
this.nome = nome;
}
public Disciplina() {
}
// Methods
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
if (!(nome.isEmpty() || nome == " " || nome == " ")){
this.nome = nome;
}
}
#Override
public String toString() {
return nome;
}
}
My problem is: this actually don't works. When I select some checkbox and submit, this create a new Curso but the arraylist of selected Disciplina still empty. I think the problem is that JSF can't find Omnifaces converter. This is my HTML tag in view:
<html xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:o="http://omnifaces.org/ui"
xmlns:of="http://omnifaces.org/functions">
When I hover the "converter" in selectManyCheckbox appears a warning:
'omnifaces.SelectItemsConverter' converter id is not registered.
I putted the Omnifaces JAR inside Web-Inf/lib. To me, everything is okay, why Omnifaces don't populate my ArrayList with the selected items?
Edit
This is the button to submit the form with the checkboxes:
<h:commandButton id="enviar" styleClass="btn btn-lg btn-success pull-right" value="Adicionar" action="#{cursoMBean.cadastrar}">
<f:ajax event="click" onevent="insert.hide()" render=":meuForm:minhaTabela"
listener="#{cursoMBean.cadastrar}" />
</h:commandButton>
And here is the called method:
public String cadastrar() {
Curso curso = new Curso();
System.out.println("Check if listaDisciplinasDoCurso have something inside): " + listaDisciplinasDoCurso.size() +"\n");
for (Disciplina d : listaDisciplinasDoCurso) {
System.out.println(d);
}
if (!(this.getNome().isEmpty() || this.getNome() == " " || this
.getNome() == " ")) {
curso.setNome(this.getNome());
// Clearing the listaDisciplinasDoCurso
listaDisciplinasDoCurso = new ArrayList<Disciplina>();
// Adding course to database
controleCurso.adicionar(curso);
System.out.println("Inserted. " + curso.toString());
} else {
System.out.println("Error: Not inserted. " + curso.toString());
}
limparCampos();
atualizarListagem();
return null;
}
Edit 2
My newest code, with two forms:
<h:form id="inserirDisciplina">
<div class="form-group">
<div class="col-md-10">
<h:inputText styleClass="form-control" id="disciplina" value="#{cursoMBean.nome}" valueChangeListener="#{cursoMBean.atualizarListagemPesquisa}">
<f:ajax event="keyup" render=":meuForm:minhaTabela" />
</h:inputText>
</div>
<div class="col-md-2">
<h:commandButton value="Adicionar" styleClass="btn btn-md btn-success" process="disciplina" partialSubmit="true">
<p:ajax event="click" update=":meuForm:display" render=":meuForm:dialog" partialSubmit="true" process="disciplina" oncomplete="PF('insert').show();" onerror="alert('erro');" />
</h:commandButton>
</div>
</div>
</h:form>
<p:messages autoUpdate="true" />
<p:dialog id="dialog" header="Inserir Curso" widgetVar="insert"
resizable="false" modal="true" width="600" height="500"
hideEffect="clip" closeOnEscape="true">
<h:form>
<h:panelGrid id="display" styleClass="col-lg-10 center" style="margin-top: 10px; margin-bottom: 15px;">
<label for="nome">Nome:</label>
<p:inputText styleClass="form-control adicionar" id="nome" value="#{cursoMBean.nome}">
</p:inputText>
</h:panelGrid>
<h:panelGrid styleClass="col-lg-10 center">
<p:columnGroup>
<label for="disciplinas">Disciplinas do Curso:</label>
<h:selectManyCheckbox style="margin-bottom: 40px;" id="disciplinas" value="#{cursoMBean.listaDisciplinasDoCurso}" converter="omnifaces.SelectItemsConverter">
<f:selectItems value="#{cursoMBean.listaTodasDisciplinas}" var="disciplina" itemValue="#{disciplina}" itemLabel="#{disciplina.nome}" />
</h:selectManyCheckbox>
</p:columnGroup>
</h:panelGrid>
<h:panelGrid styleClass="col-lg-10 center">
<p:columnGroup>
<h:commandButton id="enviar" styleClass="btn btn-lg btn-success pull-right" value="Adicionar" action="#{cursoMBean.cadastrar}">
<f:ajax event="click" execute="#form" onevent="insert.hide()" render=":meuForm:minhaTabela" listener="#{cursoMBean.cadastrar}" />
</h:commandButton>
</p:columnGroup>
</h:panelGrid>
</h:form>
</p:dialog>
As to the Eclipse warning mentioned in the title,
'omnifaces.SelectItemsConverter' converter id is not registered
just ignore it. It's actually registered via a #FacesConverter annotation. It's only the IDE who's not smart enough to detect the #FacesConverter annotated classes in JARs deployed in /WEB-INF/lib. It's only looking for <converter> entries in faces-config.xml. Try to actually run the webapp project. If the converter wasn't properly registered, then you should have gotten the following exception:
javax.faces.FacesException: Expression Error: Object named: omnifaces.SelectItemsConverter not found
Coming back to your concrete problem, those static properties aren't right. Remove those static modifiers. Also, the <f:ajax> executes by default the current component, as in
<f:ajax execute="#this">
You need to specify it to #form if you intend to execute the entire form
<f:ajax execute="#form">
Also, the onevent="insert.hide()" is wrong. The onevent attribute should point to a function reference, not perform a function call. The function reference is in turn called three times per ajax request. Just use <h:commandButton onclick> for that instead.
Unrelated to the concrete problem, also get rid of event="click" it's the default already. There's no need to repeat the defaults.

Resources