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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:33:48+00:00 2026-06-14T04:33:48+00:00

I getting a Conversion Error when try delete or edit a user from a

  • 0

I getting a Conversion Error when try delete or edit a user from a table in my application. The value is being passed in the metadata from the listUser.xhmtl to the deleteUser.xhtml page. The value is being passed in the metadata but for some reason upon calling the delete action I get the Conversion Error setting value "someemail@somedomain.com" for 'null Converter'. The user id is a String.

This is the url after requesting the userDelete.xhmtl:

http://localhost:8080/lavpWebApp/user/deleteUser.xhtml?user=someemail%40somedomain.com

This is the userList.xhmtl simplified:

<h:column>
                            <f:facet name="header">Edit</f:facet>
                            <h:link outcome="/user/editUser.xhtml" value="Edit User">
                                <f:param name="user" value="#{item.email}"/>
                            </h:link>                            
                        </h:column>

                        <h:column>
                            <f:facet name="header">Delete</f:facet>
                            <h:link outcome="/user/deleteUser.xhtml" value="Delete User">
                                <f:param name="user" value="#{item.email}"/>
                            </h:link>
                        </h:column>

This is userDelete.xhtml simplified:

<f:metadata>
        <f:viewParam name="user" value="#{userController.user}" converter="#{userConverter}"/>
    </f:metadata>

    <h:body>
        Do you want to delete #{userController.user.name}?
        <h:form>
            <h:commandButton action="#{userController.deleteUser()}"
                             value="Delete"/>
            <h:commandButton action="#{userController.doCancelDeleteUser()}"
                             value ="Cancel"/>
        </h:form>
    </h:body>

This is the Converter class:

@ManagedBean
@FacesConverter(value="userConverter")
public class UserConverter implements Converter{

    @EJB
    private UserSellerEJB userEjb;

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        if (value == null || value.isEmpty())
        {
            return null;
        }
        if(!value.matches("\\d+"))
        {
            throw new ConverterException("The value is not a valid email: " + value);
        }

        String id = value.toString();
        return userEjb.findUserById(id);

    }

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {
        if(value == null)
        {
            return null;
        }

        if(!(value instanceof UserSeller))
        {
            throw new ConverterException("The value is not a User: " + value);            
        }

        String id = ((UserSeller) value).getEmail();
        return (id != null) ? id.toString() : null;
    }

}

This is the userController class simplified:

@Named
@RequestScoped
public class UserController{

    @EJB
    private UserSellerEJB userEJB;

    private UserSeller user = new UserSeller(); 
    private List<UserSeller> usersList = new ArrayList<UserSeller>();

    // ------------------------------------------------------------- Constructor
    public UserController() {
    }

    // -------------------------------------------------------- Business Methods

    public String doCreateUser()
    {
        user = userEJB.createSeller(user);
        usersList = userEJB.findAllSellers();
        return "listUser?faces-redirect=true";        
    }

        // update user

        public void PreRenderView()
        {
            if(user == null)
            {
                user = new UserSeller();
            }            
        }

        public String doUpdateUser()
        {
            if(user.getEmail() != null)
            {
                userEJB.updateSeller(user);
            }
            else
            {
                userEJB.createSeller(user);
            }

            return "listUser?faces-redirect=true";
        }

    public String deleteUser()
    {
        userEJB.deleteSeller(user);
        return "listUser?faces-redirect=true";
    }

    public String doCancelDeleteUser()
    {
        return "listUser?faces-redirect=true";
    }


    @PostConstruct
    public void init()
    {
        usersList = userEJB.findAllSellers();       
    }
  • 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-14T04:33:50+00:00Added an answer on June 14, 2026 at 4:33 am

    The null converter in the exception message indicates that the converter instance cannot be found. Since you’re referencing the converter as a managed bean by converter="#{userConverter}, it would only be found if it’s annotated with @javax.faces.bean.ManagedBean and if the class is located in the WAR (and thus not in the EJB/EAR or elsewhere!).

    The @FacesConverter annotation isn’t been used in this construct and in fact superfluous — and only confusing to starters. Remove that annotation. The @EJB works indeed only in managed beans.

    If really in vain (I could however not explain why), try managing it by CDI instead: replace the JSF @ManagedBean annotation by the CDI @Named annotation. You’re apparently already successfully managing front controller beans by CDI.


    Unrelated to the concrete problem, the converter seems to be designed to convert based on a technical ID (a DB primary key), not an email address. An email address can never match \d+ (which is regex for “digits only”). Make sure that you’re not confusing email address with ID.

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

Sidebar

Related Questions

In my ASP.Net Web-Application, I'm getting this error: Conversion from type 'DBNull' to type
I am getting a conversion error every time I try to submit a date
I am getting the error Conversion failed when converting date and/or time from character
I'm getting a compile error conversion from 'int*' to non-scalar type 'foo< int>' requested
Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data
Hi I am getting an error 'Conversion failed when converting date and/or time from
I'm getting this warning from sccanf() : ../../../../ext/oedipus/oedipus.c:211: warning: conversion lacks type at end
I'm getting an error message: unimplemented or unreasonable conversion requested using the following code:
I am getting conversion error when running the below sql in store procedure becasue
Hey I am getting this error: error: conversion to non-scalar type requested Here are

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.