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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:40:13+00:00 2026-05-27T15:40:13+00:00

Passing a Enum value as a parameter from JSF This question already deals with

  • 0

Passing a Enum value as a parameter from JSF

This question already deals with this issue, however the proposed solution has not worked for me. I define the following enumeration in my backing bean:

public enum QueryScope {
  SUBMITTED("Submitted by me"), ASSIGNED("Assigned to me"), ALL("All items");

  private final String description;

  public String getDescription() {
    return description;
  }

  QueryScope(String description) {
    this.description = description;
  }
}

Then I use it as a method parameter

public void test(QueryScope scope) {
  // do something
}

And use it via EL in my JSF page

<h:commandButton
      id        = "commandButton_test"
      value     = "Testing enumerations"
      action    = "#{backingBean.test('SUBMITTED')}" />

So far so good – identical to the problem posed in the original question. However I have to deal with a javax.servlet.ServletException: Method not found: %fully_qualified_package_name%.BackingBean.test(java.lang.String).

So it seems that JSF is interpreting the method call as if I would like to call a method with String as parameter type (which of course does not exist) – therefore no implicit conversion takes place.

What could be the factor that makes the behavior differ in this example from the aforelinked?

  • 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-27T15:40:13+00:00Added an answer on May 27, 2026 at 3:40 pm

    In your backingBean, you may have written a method with the enum parameter:

    <!-- This won't work, EL doesn't support Enum: -->
    <h:commandButton ... action="#{backingBean.test(QueryScope.SUBMITTED)}" />
    
    // backingBean:
    public void test(QueryScope queryScope) {
        // your impl
    }
    

    But, the proposed solution does not use enum, it uses String. That’s because EL doesn’t support enum at all:

    <!-- This will work, EL does support String: -->
    <h:commandButton ... action="#{backingBean.test('SUBMITTED')}" />    
    
    // backingBean:
    public void test(String queryScopeString) {
        QueryScope queryScope = QueryScope.valueOf(queryScopeString);
        // your impl
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function accepting an enum value as parameter. As an example, consider
I am retrieving some configuration from a service and passing this data to the
passing post data using cURL requires that the name of the input. However, I
warning: passing argument 1 of 'bsearch' makes pointer from integer without a cast and
I'm passing a reference of a form to a class. Within this class I
I'm used to passing around string like this in my C++ applications: void foo(const
What is the best way to get a Unique ID from an ENUM that
When passing forward declared struct or a class, one has to pass it to
I have this: enum Units { Pounds, Kilos }; struct Configuration { const Units
I have written code to TryParse enum either by value or by its name

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.