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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:46:58+00:00 2026-06-01T13:46:58+00:00

I have a simple JSF web app as follows. The Java class contains: private

  • 0

I have a simple JSF web app as follows. The Java class contains:

private String myString;

public String getMyString()
{
  return myString;
}

public void setMyString( String radioValue )
{
  myString = someHashMap.get( radioValue );
  doStuffWith( myString );
}

And the JSF page source contains:

<h:form>
 <h:selectOneRadio id="topicSelectOneRadio" required="true"
    requiredMessage="Choose a thing"
    value="#{someBean.myString}">
    <f:selectItem itemValue="radioValue1" itemLabel="1"/>
    <f:selectItem itemValue="radioValue2" itemLabel="2"/>
 </h:selectOneRadio>
 <p><h:commandButton value="Do it"/></p>
</h:form>

As I understand it, the radioValueX string from the webpage is being used in the Java class as the parameter to the myString setter method. So I wanted to extend it one step further to use any class:

private Foo myFoo;

public Foo getMyFoo()
{
  return myFoo;
}

public void setMyFoo( String radioValue )
{
  myFoo = someHashMap.get( radioValue );
  doStuffWith( myFoo );
}

and

<h:form>
 <h:selectOneRadio id="topicSelectOneRadio" required="true"
    requiredMessage="Choose a thing"
    value="#{someBean.myFoo}">
    <f:selectItem itemValue="radioValue1" itemLabel="1"/>
    <f:selectItem itemValue="radioValue2" itemLabel="2"/>
 </h:selectOneRadio>
 <p><h:commandButton value="Do it"/></p>
</h:form>

However, I get the following error:

Conversion Error setting value 'radioValue' for 'null Converter'.

I’m not sure I understand where any sort of “conversion” needs to take place. In both cases, the String value from the radio button is being used as a parameter to a setter method which takes a String value as the parameter. True, in the latter case, it is actually setting the value for something that isn’t a String, but that shouldn’t matter, should it? I’m not trying to convert the radioValueX String in the latter case to any other type, just using it as the key to a hashmap, same as in the first case.

Can anybody help me understand what I’m missing? Thanks!

  • 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-01T13:47:00+00:00Added an answer on June 1, 2026 at 1:47 pm

    JSF tries to convert your String to Object before the setter is called. And since you have no converter registered for your object, you get this error.

    Conversion is performed in JSF’s lifecycle phase 3 (PROCESS VALIDATIONS). The setters are called in phase 4 (UPDATE MODEL VALUES).

    You need to add a converter to make it work:

    import javax.faces.convert.Converter;
    ...
    @FacesConverter("FooConverter")
    public class FooConverter implements Converter{
      @Override
      public Object getAsObject(FacesContext context, UIComponent component,
                String value) {
        someHashMap.get(value);
      }
      @Override
      public String getAsString(FacesContext context, UIComponent component,
                Object value) {
        // convert from Object to String
       }    
    }
    

    Use the converter this way:

    <h:selectOneRadio id="topicSelectOneRadio" required="true"
        requiredMessage="Choose a thing"
        value="#{someBean.myFoo}">
        <f:converter converterId="FooConverter"/>
        <f:selectItem itemValue="radioValue1" itemLabel="1"/>
        <f:selectItem itemValue="radioValue2" itemLabel="2"/>
    </h:selectOneRadio>
    

    Then (as correctly stated in Ian’s comment to your question) you should change your setter since you don’t need the conversion here anymore:

    public void setMyFoo(Foo newFoo)
    {
      myFoo = newFoo;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im working in a Web App with Java and JSF. I have a simple
i have a simple problem here i am making a simple jsf web app
I have the following 3 simple pages in a JSF app. index.html start.html confirmSuccess.thml
I have created simple Java Dynamic Web project in Eclipse. I host my project
I have a simple scrollableDataTable in a jsf <%@ taglib uri=http://java.sun.com/jsf/core prefix=f %> <%@
In a simple demo web app using JSF 2 and Ajax, there is a
I'm new to Web java programming. I want to create a simple JSF modular
I am having problem when running my simple JSF hello-world like web app. The
I have created a simple JSF image browsing app, and I'm having a problem
Possible Duplicate: Can anyone recommend a simple Java web-app framework? I want to know

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.