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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:14:31+00:00 2026-06-03T16:14:31+00:00

I am stuck and need outside help from JSF experts with the following problem:

  • 0

I am stuck and need outside help from JSF experts with the following problem:
I defined some converters in the faces-config.xml for specific classes so I don’t have to use the converter-attribute or tag all the time. For example:

    <converter>
      <converter-for-class>org.joda.time.DateTime</converter-for-class>
      <converter-class>com.example.converter.JodaDateTimeConverter</converter-class>
    </converter>

Now there is the need for a crawler for a JSF-Component (mostly rich:extendedDataTable) which builds the whole component tree and converts level after level into CSV, HTML or whatever might be needed later on. Namely a generic way to export to CSV, HTML, … without the need to implement it every single time anew. It is almost done (thanks to the great idea of an old colleague of mine) and it does work great except for one part:

    Object expressionResult = expression.getValue(FacesContext.getCurrentInstance().getELContext());
    expressionResultString = expressionResult.toString();

That command retrieves the value of an h:outputText and converts it to String. That last line is what I want to replace with the converter-for-class if there is a custom converter for a specific expressionResult. I can’t find out how to find that exact converter for my classes (as specified by faces-config). The FacesContext doesn’t seem to hold any useful method/object for my use case. Accessing the faces-config.xml directly seems kind of wrong. A correct approach might look something like:

    Converter converter = magically_fetch_the_correct_converter_for_expressionResult_type;
    converter.getAsString(FacesContext.getCurrentInstance(), component,
                                expressionResult);

It would be fairly easy if I used converter-id and the appropriate attribute/tag for the components themselves but I really want to avoid that kind of useless additional code.

Can someone out there please help me?

  • 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-03T16:14:32+00:00Added an answer on June 3, 2026 at 4:14 pm

    You’re looking for Application#createConverter().

    Object object = expression.getValue(context.getELContext());
    Class<?> type = expression.getType(context.getELContext());
    Converter converter = context.getApplication().createConverter(type);
    String string = converter.getAsString(context, component, object);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm completely stuck and need your help... I've created a webservice stub with jaxb
I am stuck and in need of a hand. Hope someone can help? Anyone
I am stuck in a problem, I need to solve a problem, here it
I'm stuck with the following. I'm programming a game and I need to get
I am stuck and need help. I have 5 text boxes: txt1 , txt2
I am having a weird problem here, and I am really stuck, need to
I stuck here need help Ruby on rails I have one Pop-up for login
At the moment I'm stuck with the need to debug several functions in our
i have string that i need to make custom parser but i am stuck
Got stuck here: http://jsfiddle.net/UFkg8/ Right now the animation is top-down. What do I need

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.