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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:23:17+00:00 2026-06-13T01:23:17+00:00

I created another question hoping I could find my answer, but I went in

  • 0

I created another question hoping I could find my answer, but I went in the wrong direction. Here is that question for reference( How do I parse this into a MultiValued Map?)

I am pulling a String Array out of a property file (using Apache Configuration) and the array comes in and looks like this

name,5486984,189.658.235.215,3.158.68.15,name2,189189,189.658.218.268,3.158.68.13...

Here is part of the JSF

<f:selectItems itemValue="#{mainBean.information}" value="#mainBean.information}" />

Here is a snippet of the Java

Private String [] information;
information = config.getStringArray("information"); // This brings in this string from the property file

I’ve been referencing this http://www.horstmann.com/corejsf/refcard.html

So with what I have here, that I just posted. It will populate every element of that string array. I only want the “name” to show up and the three other values to be passed as the actual “value”.

I tried to make a Map object that is a string and a string array but JSF refuses to take it.

  • 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-13T01:23:19+00:00Added an answer on June 13, 2026 at 1:23 am

    I tried to make a Map object that is a string and a string array but JSF refuses to take it.

    A Map should work. You can find a concrete example in our selectOneMenu tag wiki page. The map key becomes the option label and the map value becomes the option value.

    You should only realize that the option value ultimately ends up in the HTML response, inside the value attribute of the HTML <option> element like so

    <option value="someValue">
    

    As HTML is in fact plain text, you cannot represent non-standard Java objects in HTML without converting them first. A String[] is non-standard and when you don’t explicitly specify a converter, then by default the Object#toString() result will be inlined in HTML and it would in case of a String[] look like

    <option value="[Ljava.lang.String;@1860045">
    

    Exactly that value is in turn thus submitted to the server side when the option is selected. However, as the value is an unintelligible sequence of characters, it isn’t possible to convert it back to the original String[] value using Java/JSF/EL in any way.

    Instead of providing a converter, you can also just pass only a List<String> containing the names around.

    <h:selectOneMenu value="#{bean.name}">
        <f:selectItems value="#{bean.names}" />
    </h:selectOneMenu>
    

    When processing the form submit, you could just get the associated String[] back based on the submitted name straight from the configuration file or some Map which is remembered as bean property.

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

Sidebar

Related Questions

I am trying to emulate another form that the other developer here created. In
For another question I have created some XML related code that works on my
another question of mine. I have created a screen that consists of a Spinner
I'm almost certain I know the answer to this question, but I'm hoping there's
I created a form that overlays on top of another form in an alpha
I have created two viewController classes such that one is superclass of another.i have
I realize that this question is slightly server related and could be posted on
I was hoping someone could show how to properly append an array created with
when I google the title of my question I get another stackoverflow question that
I'm hoping this is a rather simple question, but I'm pretty new to MVC

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.