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

  • Home
  • SEARCH
  • 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 8897193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:16:32+00:00 2026-06-15T00:16:32+00:00

I am facing a strange problem with p:autoComplete, I get following error java.lang.NumberFormatException: For

  • 0

I am facing a strange problem with p:autoComplete, I get following error

java.lang.NumberFormatException: For input string: “player”

My code is as below

xhtml

<p:autoComplete id="schedChemAC" value="#{testMB.selectedPlayer}" completeMethod="#{testMB.completePlay}" process="@this" var="m" itemLabel="#{m.player}" itemValue="#{m}" converter="#{testConverter}">
     <p:ajax event="itemSelect" listener="#{testMB.onSelectFrstL}" process="@this"/>
</p:autoComplete>

MBean

public List<Player> getSelectedPlayer() {
    return selectedPlayer;
}

public void setSelectedPlayer(List<Player> selectedPlayer) {
    this.selectedPlayer = selectedPlayer;
}

public void getName() {
    playerName = playerSession.getAll();
}

public List<Player> completePlay(String query) {
    List<Player> suggestion = new ArrayList<Player>();
    if (playerName == null) {
        getName();
    }
    for (Player c : playerName) {
        if (c.getPlayer().toUpperCase().contains(query.toUpperCase())) {
            suggestion.add(c);
        }
    }
    return suggestion;
}

public void onSelectFrstL(SelectEvent event) {

}

Converter

@Named(value = "testConverter")
public class TestConverter implements Converter {

@EJB
PlayerSession playSession;
public static List<Player> playLst;

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

    if (playLst == null) {
        playLst = playSession.getAll();
    }
    if (value.trim().equals("")) {
        return null;
    } else {
        try {
            int number = Integer.parseInt(value);

            for (Player c : playLst) {
                if (c.getPk() == number) {
                    return c;
                }
            }

        } catch (Exception ex) {
            System.out.println("error");
        }

    }
    return null;
}

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

    if (value == null || value.equals("")) {
        return "";
    } else {
        return String.valueOf(((Player) value).getPk());
    }
}

}

I am not able to find what is wrong in the above code, if i remove the var,itemValue,itemLabel,converter part then it works fine but once i put the var,itemValue,itemLabel,converter code (as given in prime showcase) i get the above error.
Kindly guide me on what is that i am doing wrong or what is that i should check.

Note: My sample table has only two columns, pk(int) & player(string).

  • 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-15T00:16:33+00:00Added an answer on June 15, 2026 at 12:16 am

    I figured out the problem, its basically if i Pass a List to value(AutoComplete) then the Multiple=”true” has be used. Whereas to just do one selection i need to pass only Player object to value(AutoComplete).
    Hope this helps somebody else who post without understanding how it works (like me).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing this strange problem with the following section of code <% if
I am facing a strange problem. My PHP page has following code. echo <div
I'm facing a strange problem with CSS overriding of 'font-weight' property. Given below is
I am facing this strange problem with strings. I assigned a string like this:
I am facing a strange problem while creating a file in java using MYSQL.
hello every one i am facing a strange problem i my code i am
I am working in a legacy code, and I am facing a strange problem.
today i was facing a strange problem: got a 'missing method' error on a
I'm facing a strange problem and I can't figure out why I systematically get
I am facing a strange problem while creating edit functionality in cakephp 2.1 Error

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.