I want to create very simple JSF web page which I would like to use for price calculation:
<h:form>
<h:outputText value="Number of Computers"/>
<h:panelGroup layout="block" id="desktopClients_select" style="padding-top: 3px;" styleClass="text">
<h:inputText id="desktopClients" value="#{pricingCalculator.computers}">
<f:ajax event="change" render="#form" listener="#{pricingCalculator.calculateTotalPrice}"/>
</h:inputText>
</h:panelGroup>
<h:outputText value="Email support incidents"/>
<h:panelGroup layout="block" id="email_support_incidents" style="padding-top: 3px;" styleClass="text">
<h:inputText id="email_support_incidents_text" value="#{pricingCalculator.emailSupportIncidents}">
<f:ajax event="change" render="#form" listener="#{pricingCalculator.calculateTotalPrice}"/>
</h:inputText>
</h:panelGroup>
<h:outputText value="Phone support incidents"/>
<h:panelGroup layout="block" id="phone_support_incidents" style="padding-top: 3px;" styleClass="text">
<h:inputText id="phone_support_incidents_text" value="#{pricingCalculator.phoneSupportIncidents}">
<f:validateLongRange minimum="1" maximum="150" />
<f:ajax event="change" render="#form" listener="#{pricingCalculator.calculateTotalPrice}"/>
</h:inputText>
</h:panelGroup>
<h:outputText value="Total price"/>
<h:panelGroup layout="block" id="total_price" style="padding-top: 3px;" styleClass="text">
<h:outputText value="#{pricingCalculator.calculateTotalPrice}"/>
</h:panelGroup>
</h:panelGrid>
</h:form>
Bean:
#Named
#ViewScoped
public class PricingCalculator implements Serializable
{
private int computers;
private float emailSupportIncidents;
private float phoneSupportIncidents;
private float totalPrice;
// Prices for each component and service
private final float computers_price = 299;
private final float emailSupportIncidents_price = 300;
private final float phoneSupportIncidents_price = 150;
public String getCalculateTotalPrice()
{
totalPrice = (computers_price * computers)
+ (emailSupportIncidents_price * emailSupportIncidents)
+ (phoneSupportIncidents_price * phoneSupportIncidents);
String result = Float.toString(totalPrice);
return result;
}
public int getComputers()
{
return computers;
}
public void setComputers(int computers)
{
this.computers = computers;
}
public float getEmailSupportIncidents()
{
return emailSupportIncidents;
}
public void setEmailSupportIncidents(float emailSupportIncidents)
{
this.emailSupportIncidents = emailSupportIncidents;
}
public float getPhoneSupportIncidents()
{
return phoneSupportIncidents;
}
public void setPhoneSupportIncidents(float phoneSupportIncidents)
{
this.phoneSupportIncidents = phoneSupportIncidents;
}
public float getTotalPrice()
{
return totalPrice;
}
public void setTotalPrice(float totalPrice)
{
this.totalPrice = totalPrice;
}
}
When I insert some value into the input fields I would like to recalculate the total price. I have now two issues: I get exception serverError: class javax.el.MethodNotFoundException /pricing_calculator.xhtml #115,136 listener="#{pricingCalculator.calculateTotalPrice}": Method not found: com.web.common.PricingCalculator#22939533.calculateTotalPrice(javax.faces.event.AjaxBehaviorEvent)
and when I insert new value previous one is set to zero. It's not remembered properly.
#BalusC has already given you the answer, but to be more explicit, here's a quote from Oracle's Java EE 6 tutorial (which you should read) about Method Expressions:
Method expressions can be used only in tag attributes and only in the
following ways:
With a single expression construct, where bean refers to a JavaBeans component and method refers to a method of the JavaBeans
component:
<some:tag value="#{bean.method}"/>
[...]
That said, rename getCalculateTotalPrice to calculateTotalPrice
Edit: There's also an inconsistency between the expected signatures of the following method calls:
<f:ajax listener="#{pricingCalculator.calculateTotalPrice} .../>
which expects a MethodExpression refering to a calculateTotalPrice(javax.faces.event.AjaxBehaviorEvent) method as clearly stated by the javax.el.MethodNotFoundException
and
<h:outputText value="#{pricingCalculator.calculateTotalPrice}"/> which expects a java.lang.String that can refer to a bean property, or the return value of a method call.
Here, the <h:outputText> value is probably meant to be set to the totalPrice property, so it should be: <h:outputText value="#{pricingCalculator.totalPrice}"/>
Related
I have an issue where I have a primefaces outputtext field and from the managed bean, I'm attempting to return an array type back to this field. Something is amiss in that I'm getting no return value back to my outputtext field. I will admit that I'm a bit rusty on my Java coding skills and it could be that I'm not performing something correctly within my bean method with respect to my return value.
My JSF page outputtext field
<p:panel id="horizontal" header="Conversion from Lat Long to MGRS" toggleable="true" toggleOrientation="horizontal">
<h:panelGrid columns="2" cellpadding="10" styleClass="left">
<h:outputLabel for="lat" value="Enter Latitude:" />
<p:inplace id="lat">
<p:inputText value="Latitude" />
</p:inplace>
<h:outputLabel for="long" value="Enter Longitude:" />
<p:inplace id="long">
<p:inputText value="Longitude" />
</p:inplace>
<h:outputLabel for="mgrs" value="MGRS conversion value:" />
<h:outputText id="mgrs" value="#{coordinates.MGRSCoordreturn}" />
<p:commandButton value="Submit" update="mgrs" icon="ui-icon-check" actionListener="#{coordinates.mgrsFromLatLon(lat, long)}"/>
</h:panelGrid>
</p:panel>
<h:outputLabel for="mgrs_input" value="Enter MGRS:" />
<p:inplace id="mgrs_input">
<p:inputText value="MGRS" />
</p:inplace>
<h:outputLabel for="mgrs_output" value="Lat Long conversion values:" />
<h:outputText id="mgrs_output" value="#{coordinates.latLongVReturn}" />
<p:commandButton value="Submit" update="mgrs_output" icon="ui-icon-check" actionListener="#{coordinates.latLonFromMgrs(mgrs_input)}"/>
My managed bean code:
#ManagedBean
#SessionScoped
public class Coordinates implements Serializable{
private String MGRSCoordreturn;
private Double LatLongVReturn;
public String mgrsFromLatLon(double lat, double lon){
// 37.10, -112.12
Angle latitude = Angle.fromDegrees(lat);
Angle longitude = Angle.fromDegrees(lon);
MGRSCoordreturn = MGRSCoord.fromLatLon(latitude, longitude).toString();
return MGRSCoord.fromLatLon(latitude, longitude).toString();
}
public String getMGRSCoordreturn() {
return MGRSCoordreturn;
}
public void setMGRSCoordreturn(String MGRSCoordreturn) {
this.MGRSCoordreturn = MGRSCoordreturn;
}
public double[] latLonFromMgrs(String mgrs){
MGRSCoord coord = MGRSCoord.fromString("31NAA 66021 00000");
double LatLongVReturn[] = new double[]{
coord.getLatitude().degrees,
coord.getLongitude().degrees
};
return new double[]{
coord.getLatitude().degrees,
coord.getLongitude().degrees
};
}
public Double getLatLongVReturn() {
return LatLongVReturn;
}
public void setLatLongVReturn(Double LatLongVReturn) {
this.LatLongVReturn= LatLongVReturn;
}
}
I have a p:inputTextarea and I need the value of it while processing the form. It turned out that every time I submit the form I get all the values except the one from the textarea. #{xyzUI.description} is a String object with regular getters and setters.
<ui:composition>
<h:form id="form1">
<p:panel rendered="...">
<p:panel id="formPanel">
<p:panelGrid columns="2" cellpadding="5">
<!-- other form elements -->
<p:outputLabel>Description:</p:outputLabel>
<p:inputTextarea value="#{xyzUI.description}" style="width: 350px;" counter="display" counterTemplate="{0} characters remaining" maxlength="2000" autoResize="true" rows="4" />
<h:panelGroup />
<h:outputText id="display" />
</p:panelGrid>
<p:commandButton rendered="#{not xyzUI.noChange}" action="#{xyzUI.submitForm}" update="formPanel" ajax="true" value="Apply" >
<p:ajax update="formPanel"></p:ajax>
</p:commandButton>
</p:panel>
</p:panel>
</h:form>
<ui:composition>
In my backing bean the value is always "". I don't know what's wrong.
public void submitForm()
{
...
tmp.setDescription(description); // String is always "" while debugging
myList.add(tmp);
RequestContext.getCurrentInstance().update("content");
}
I ran your code locally and discovered the issue. In the command button, remove the p:ajax call.
PrimeFaces command buttons are ajax enabled by default.
So change this:
<p:commandButton rendered="#{not xyzUI.noChange}" action="#{xyzUI.submitForm}" update="formPanel" ajax="true" value="Apply" >
<p:ajax update="formPanel"></p:ajax>
</p:commandButton>
To this:
<p:commandButton rendered="#{not xyzUI.noChange}" action="#{xyzUI.submitForm}" update="formPanel" value="Apply" />
My backing bean for reference
#ManagedBean
#ViewScoped
public class xyzUI implements Serializable{
private static final long serialVersionUID = 6259024062406526022L;
private String description;
private boolean noChange = false;
public xyzUI(){
}
public void submitForm(){
System.out.println(description);
}
public boolean isNoChange() {
return noChange;
}
public void setNoChange(boolean noChange) {
this.noChange = noChange;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
I recently was placed on a project to add some new functionality to an existing jsf page. Things have been going smoothly up until this point. For the last week or two I have been consulting google and other stack overflow entries in an attempt to make this function correctly.
I have datatable on my xhtml page with a number of entries, some which have a h:selectmanycheckbox in them. The table and the checkboxes are all dynamically created. I can create the checkboxes without any trouble. I can also set their initial state to checked or unchecked based on database entries. However, I cannot pull any changes from the user when the form is submitted. The values returned are always equal to the initial state, regardless of what the user has entered.
AddRemoveSkills.xhtml
<h:panelGrid id="allSkills" style=" width : 706px;">
<ui:repeat var="cat" value="#{skillsController.masterCategories}"
varStatus="status">
<h:form
rendered="#{cat.toString().equalsIgnoreCase(skillsController.mode)||skillsController.mode.equalsIgnoreCase('Show All Skills')}">
<h3 class="arSkillsHeader">
<h:outputLabel value="#{cat.toString()}"
style="font-weight:bold" />
</h3>
<h:dataTable style="margin-left:15px; margin-right:15px"
class="suggestionsTable" var="skill"
rowClasses="gray, lightgraybg"
columnClasses="null, hCol3, null, null"
value="#{skillsController.getSkillsByCategory(cat)}">
<h:column>
<h:graphicImage value="/resources/images/success.png"
style="height:20px"
rendered="#{skillsController.hasSkill(cat.toString(), skill.name.toString())}" />
</h:column>
<h:column>
<h:outputText value="#{skill.name.toString()}" />
</h:column>
<h:column>
<!-- CheckBoxProblems lie here -->
<h:selectManyCheckbox id="versions"
layout ="lineDirection"
style = "text-align: left;"
value = "#{skill.checkedVersions}">
<f:selectItems value="#{skillsController.getVersions(skill.getName(), skill.getCategoryName())}"/>
</h:selectManyCheckbox>
</h:column>
<h:column>
<h:selectOneMenu value="#{skill.proficiency}">
<f:selectItem
itemValue="#{skillsController.timeList.get(0)}"
itemLabel="Select Experience Level" />
<f:selectItems
value="#{skillsController.timeList.subList(1, skillsController.timeList.size())}" />
<f:ajax listener="#{skill.setModified(true)}"/>
<f:ajax event="click" render="#this" />
</h:selectOneMenu>
</h:column>
</h:dataTable>
<h:panelGroup layout="block" style="height:20px">
<h:commandButton value="Update Category" style="float:right; margin-right:15px;"
action="#{skillsController.updateCategorySkills(cat)}"
onclick="updatePro(this.id);">
<f:ajax execute="#form" render="#form" />
</h:commandButton>
</h:panelGroup>
</h:form>
</ui:repeat>
</h:panelGrid>
Skill.java
public class Skill implements Comparable<Skill> {
protected String skill;
protected String category;
private String proficiency;
private List<String> checkedVersions = new ArrayList<String>();
private boolean modified;
Logger logger = Logger.getLogger(Skill.class);
...
/**
* Gets a list of versions for this user's skill
*
* #return Returns a string list containing the versions of this skill that the user has
*/
public List<String> getCheckedVersions() {
return checkedVersions;
}
/**
* Sets a list of versions for this user's skills
*
*
* #param checkedVersions A string list of checked versions
*/
public void setCheckedVersions(List<String> checkedVersions) {
if(checkedVersions != null){
this.checkedVersions = checkedVersions;
logger.info("Inside Skill, setCheckedVersions " + checkedVersions.toString()+ "skill name is: " + this.skill );
}
}
SkillsController.java
#ManagedBean
#SessionScoped
public class SkillsController implements Serializable {
private static final long serialVersionUID = 1270888906016432185L;
#ManagedProperty(value = "#{activeUser}")
private ActiveUser user;
private TreeMap<String, Skill> allSkillMap;
private Map<String, Map<String, List<String>>> versionList;
private Map<String, Map<String, List<String>>> checkedVersionList;
public Skill getUserSkillByName(String name) {
for (Skill skill : user.getSelfEmployee().getSkills()) {
if (skill.getName().equals(name)) {
if(checkedVersionList.containsKey(skill.getCategoryName())){
if(checkedVersionList.get(skill.getCategoryName()).containsKey(skill.getName())){
skill.setCheckedVersions(checkedVersionList.get(skill.getCategoryName()).get(skill.getName()));
}
}
return skill;
}
}
return null;
}
/**
* Get Versions for Skill
*
* #param skillName
* #param categoryName
*
* #return returns a list containing all versions for this particular skill/category
*/
public List<String> getVersions(String skillName, String categoryName) {
if(versionList.containsKey(categoryName)){
if( versionList.get(categoryName).containsKey(skillName)){
return versionList.get(categoryName).get(skillName);
}
}
return null;
}
ActiveUser.java
#ManagedBean
#SessionScoped
public class ActiveUser {
private Employee selfEmployee; // the current employee object
Employee.java
#RequestScoped
public class Employee implements Comparable<Employee>, Serializable {
private static final long serialVersionUID = 4875706805440817545L;
private TreeSet<Skill> skills;
I have tried to show how all of my classes are scoped without cluttering this up with excess code. If there is anything more you would like me to add, let me know.
Thanks in advance for any help given, I am at my wit's end on this problem.
Please try to use only one form, and don't iterate through h:form. like you do here :
<ui:repeat var="cat" value="#{skillsController.masterCategories}"
varStatus="status">
<h:form
rendered="#{cat.toString().equalsIgnoreCase(skillsController.mode)||skillsController.mode.equalsIgnoreCase('Show All Skills')}">
So you can use this :
<h:form>
<ui:repeat var="cat" value="#{skillsController.masterCategories}"
varStatus="status">
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>
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.