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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:03:15+00:00 2026-05-26T12:03:15+00:00

I have a JSF2 application that uses Spring 3.0. I have a bean that

  • 0

I have a JSF2 application that uses Spring 3.0. I have a bean that has a property of type List<Double> with 5 elements:

public class MyBean {
    private List<Double> values; 
    public List<Double> getValues() {
        if (values == null) {
            values = new ArrayList<Double>(5);
                for (int i = 0; i < 5; i++) {
                    values.add(null);
                }
        }
        return values;
    }
    public void setValues(List<Double> values) {
        this.values = values;
    }
}

In my xhtml file I have this for every element:

<h:inputText id="value1" value="#{myBean.values[0]}">
    <f:convertNumber pattern="#########0.##" />
</h:inputText>

My purpose is to retrieve the values as ArrayList. Also, I do not want to keep individual properties for each member. A future requirement will make the value’s total number to be dynamic (not the hard-coded 5), so I may use a loop to define the inputs for each element, but lets not focus on this now.

So here is the problem. When I submit the page, the conversion is not correct. For instance, if my input was 1, 2.0, 3 (and 2 empty inputs for the last two elements, they are not mandatory), I am receiving the following array [1, “2.0”, 3, “”, “”], where 1 and 3 are of type BigDecimal, and 2.0 and the last 2 members are empty strings. This causes ClassCastexception each time I try to get a member of the array list, because by definition is generic and the generic type is Double. BigDecimal cannot be cast to Double; it is obvious that the string cast attempts will also fail. Now, I’d have expected at least all members to be converted by the converter and be of the same type. Also, I need a way to get correctly as Double. I also tried the following:

<h:inputText id="value1" value="#{myBean.values[0]}">
    <f:converter id="javax.faces.Double" />
</h:inputText>

but it caused an exception:

<f:converter> Default behavior invoked of requiring a converter-id passed in the constructor, must override ConvertHandler(ConverterConfig)

I must admit I am new to the JSF technology, but as far as this article is concerned, there was no need to override anything. Any help will be appreciated

  • 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-05-26T12:03:16+00:00Added an answer on May 26, 2026 at 12:03 pm

    The <f:converter> doesn’t have an id attribute, instead it is converterId. See also the tag documentation. So, this should do:

    <h:inputText id="value1" value="#{myBean.values[0]}">
        <f:converter converterId="javax.faces.Double" />
    </h:inputText>
    

    or even

    <h:inputText id="value1" value="#{myBean.values[0]}" converter="javax.faces.Double" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application written in JSF2 that uses Spring. I need to
I have web application wich uses jsf 2.0 and spring 3.0 The problem is
I'm developping a web app, with jsf2,spring and hibernate. I have an application scoped
In my JSF2 application I have a phaselistener that needs to be executed before
I have a JSF 2.0 application running on GlassFish v3. It has EJBs that
I'working on a enterprise application that uses JSF 2.0, with Netbeans 7.0 and Glassfish
I have simple JSF2 application running on glashfish 3.1. I want to add a
I have a JSF2 application and a page with the following code: <h:inputText id=someInput
Our application is JSF2 based and we are desiging a exception handling for that.
Technology(Java EE 6 with Glassfish 3.1, Netbeans 7.0) I have an application client that

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.