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 9170255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:59:29+00:00 2026-06-17T15:59:29+00:00

I have my autocomplete component connecting to my managed bean which then connects to

  • 0

I have my autocomplete component connecting to my managed bean which then connects to my service layer and gets list from the database. I am trying to reference the showcase and any other thing I find online, but I can not get my autocomplete to work. I had a cast exception, so it looked like I needed a converter. But I am having trouble writing the converter. I’m confused on how everything is passed along.

        <p:autoComplete id="placesSearchBar" value="#{searchBarBean.place}" completeMethod="#{searchBarBean.findSimilarPlaces}"
                        var="Place" itemLabel="#{Place.name}" itemValue="#{Place}" converter="PlaceConverter" />

        public class SearchBarBean 
    {
        private Place place;
        private SearchQueryService searchQueryService;
        private Criteria criteria;

        /**
         * @return the place
         */
        public Place getPlace() {
            return place;
        }

        /**
         * @param place the place to set
         */
        public void setPlace(Place place) {
            this.place = place;
        }

        /**
         * @return the searchQueryService
         */
        public SearchQueryService getSearchQueryService() {
            return searchQueryService;
        }

        /**
         * @param searchQueryService the searchQueryService to set
         */
        public void setSearchQueryService(SearchQueryService searchQueryService) {
            this.searchQueryService = searchQueryService;
        }

        /**
         * @return the criteria
         */
        public Criteria getCriteria() {
            return criteria;
        }

        /**
         * @param criteria the criteria to set
         */
        public void setCriteria(Criteria criteria) {
            this.criteria = criteria;
        }

        public List<Place> findSimilarPlaces(String query)
        {
            getCriteria().setName(query);
            List<Place> places = getSearchQueryService().findPlaces(criteria);
            return places;
        }
    }

    public class PlaceConverter implements Converter
{
    @Override
    public Object getAsObject(FacesContext arg0, UIComponent arg1, String submittedValue) {
        SearchBarBean searchBarBean = new SearchBarBean();
        return null;
    }

    @Override
    public String getAsString(FacesContext arg0, UIComponent arg1, Object value) {
         return null;
    }
}
  • 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-17T15:59:30+00:00Added an answer on June 17, 2026 at 3:59 pm

    You converter must do two things: convert a string (which gets submitted by your page) into an instance of your pojo and convert an instance of you pojo into a string so that it can be displayed on your page.

    You could achieve that by returning the primary key for place in your getAsString method. Then, in your getAsObject method, you would get that string containing the primary key for the selected item and query the database for the associated record. For that to work you’d have to have access to your query service from the converter. Give that a shot and let me know how it goes.

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

Sidebar

Related Questions

I have used autocomplete in jQuery from this link . In the normal browser
I have just built a custom autocomplete component using jquery. My problem is that
I have an autocomplete which does a query to DB....when doing a click on
I need to have an autocomplete functionality using jquery, and I've encountered ZendX_JQuery which
I have the following code to parse the country when the autocomplete list is
I have an autocomplete field which I would like to augment by providing a
Can i have autocomplete with ajax to get countries from google maps api. When
I have a selectInputText in my jsf <ice:panelPopup page which gets invoked upon clicking
I have a layout in which I have autoComplete edit text with some suggestions.
I have setuped suggester component for autocomplete for one field(it work fine), but I

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.