Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9078431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:37:14+00:00 2026-06-16T19:37:14+00:00

I have a problem with may AJAX on JSF page. He doesn’t call the

  • 0

I have a problem with may AJAX on JSF page. He doesn’t call the bean method. Converter works and returns a correct object, but bean method doesn’t call.
If I remove execute section method calls.
If I remove coverter and send only Id method calls.
Together they fail.

JSF page

<h:form id="jewelForm">
  <!-- ... -->
    <h:selectOneMenu id="material" value="#{jewelBean.material}" >
        <f:converter converterId="materialConverter"/>
        <f:selectItems value="#{jewelBean.materialList}" var="c"
                       itemLabel="#{c.name}" itemValue="#{c.id}"  />
    </h:selectOneMenu>

    <h:commandButton id="but1" value="#{titles.addThisMat}">
        <f:ajax id ="aj1"  
                listener="#{jewelBean.addMaterial}" 
                render="jewelForm:matTable"
                execute="material"/>
    </h:commandButton>

    <h:dataTable id ="matTable" 

    </h:dataTable>
    <h:commandButton value="#{titles.createThisJ}"  
                     action="#{jewelBean.saveJewel()}" />
</h:form>

bean

@ManagedBean(name = "jewelBean")
@SessionScoped
public class JewelBean implements Serializable {

private Material material;

public void addMaterial() {
    MaterialJewel mj = new MaterialJewel();
    mj.setMaterial(material);
    mj.setWeight(materialWeight);
    materialJewels.add(mj);
}

public Material getMaterial() {
    return material;
}

public void setMaterial(Material material) {
    this.material = material;
}

}

converter

@FacesConverter("materialConverter")
public class materialConverter implements Converter {

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {

    try {
    //finding object with DAO
        return material;
        }
    } catch (NumberFormatException ex) {
      }  
}

@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
    return value.toString();

}
}

Thank for your comments.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:37:15+00:00Added an answer on June 16, 2026 at 7:37 pm

    I have solved my problem. That was in selectOneMenu. The main problem was that itemValue in selectOneMenu must be the same type as value. So I have to rewrite my converter, getAsString method. Also method equals of entity must be like this.

    fixed select on of JSF page

    <h:selectOneMenu id="material" value="#{jewelBean.material}" >
          <f:converter converterId="materialConverter"/>
          <f:selectItems value="#{jewelBean.materialList}" var="c"
                         itemLabel="#{c.name}" itemValue="#{c}"  />
    </h:selectOneMenu>
    

    fixed convertor method

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {
        Material material = (Material) value;
        return (material.getId() != 0) ? String.valueOf(material.getId()) : null;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a situation where my Ajax call to the server may take a
I have a Ajax heavy application that may have a URL such as http://example.com/myApp/#page=1
An ajax call creating problem. It works fine in browser but through ajax it
I think I have a synchronization problem...It may be too basic..Please help.. I have
I have a problem that I thought someone may be able to help me
As the title may suggest, I have been using jQuery AJAX to try and
I have an ajax control toolkit modal popup on my page and in that
One of my colleagues is having a problem with an AJAX call to a
In our web application,we have do some ajax request,so we may meet the cross
I have application with many ajax actions (implemented using JQuery.ajax), that returns JSON ot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.