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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:48:08+00:00 2026-06-13T02:48:08+00:00

I replaced rich:pickList to selectManyListbox for testing, when submit values to server it still

  • 0

I replaced rich:pickList to selectManyListbox for testing, when submit values to server it still displays error: “Validation Error: Value is not valid”. I also set breakpoint to debug StaffConverter (getAsobject), but system never invokes it. Pls let me know some reasons why my converter never invoked and suggest me how to fix this. thanks

xhtml file:

<h:selectManyListbox value="#{reportController.selectedStaffList}" converter="staffConverter">
   <f:selectItems value="#{reportController.staffList}" 
                  var="item" itemValue="#{item}" itemLabel="#{item.name}" />
</h:selectManyListbox>

<rich:pickList value="#{reportController.selectedStaffList}" converter="staffConverter" sourceCaption="Available flight" targetCaption="Selected flight" listWidth="195px" listHeight="100px" orderable="true">
   <f:selectItems value="#{reportController.staffList}" var="item" itemValue="#{item}" itemLabel="#{item.name}" />
</rich:pickList>

My Converter:

@FacesConverter(forClass = Staff.class)
public static class StaffConverter implements Converter {

    public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
        if (value == null || value.length() == 0) {
            return null;
        }
        StaffController controller = StaffController.getInstance();
        return controller.facade.find(Staff.class, getKey(value));
    }

    java.lang.Integer getKey(String value) {
        java.lang.Integer key;
        key = Integer.valueOf(value);
        return key;
    }

    String getStringKey(java.lang.Integer value) {
        StringBuffer sb = new StringBuffer();
        sb.append(value);
        return sb.toString();
    }

    public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
        if (object == null) {
            return null;
        }
        if (object instanceof Staff) {
            Staff o = (Staff) object;
            return getStringKey(o.getStaffCode());
        } else {
            throw new IllegalArgumentException("object " + object + " is of type " + object.getClass().getName()
                    + "; expected type: " + StaffController.class.getName());
        }
    }
}

I implemented equals method in Staff:

@Override
public boolean equals(Object object) {
    if (!(object instanceof Staff)) {
        return false;
    }
    Staff other = (Staff) object;
    return (this.staffCode == other.staffCode);
}
  • 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-13T02:48:09+00:00Added an answer on June 13, 2026 at 2:48 am

    Thanks Brian and BalusC for your help. I fixed my problem by adding named converter inside selectManyListbox & rich:picklist so they run well. But normally, I only use @FacesConverter(forClass = Staff.class), and don’t need to add named converter in jsf so they still run well except for selectManyListbox & rich:picklist

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

Sidebar

Related Questions

I have developed a desktop database application. But the interface is not rich. So
Given this code, <rich:dataTable id=list value=#{testBeen.dataModel} var=test rows=#{testBeen.dataModel.pageSize}> ... <h:outputText value=#{test.WEEK} /> I need
I replaced: panel.Controls.Clear(); with: Clear(panel); Where: public static void Clear(Control ctrl) { while (ctrl.Controls.Count
Update: Replaced the destructor example with a straight up method call example. Hi, If
I have replaced a table containing four tables (in a grid) with a div-table
and is flash being replaced by another standard like html 5 completely?
Here is my query (I replaced table names with generic ones). I am trying
The HttpModule works fine (hello is replaced with hello world) but for some reasons
I have a div with is replaced upon certain user actions. These actions are
ASP.NET MVC 2 Dots Replaced With Underscore In Element Name (even though ASP.NET MVC

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.