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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:03:40+00:00 2026-05-16T11:03:40+00:00

With this code, I am able to return one image based off of a

  • 0

With this code, I am able to return one image based off of a dropdown selection. Any ideas on how to return multiple images (I have attempted to create an ArrayList with the images and use the UI:Repeat tag to render it back to my view, but I was unsuccessful. Here is my current code now, which works but only returns one image. Any ideas on what approach to take to get more than one image?

Java Code:

(Person class has attribute: private String theImage;)

public String getTheImage(){

    if(this.theSchoolChoice.equals("University of Alabama")){
        theImage = "/resources/gfx/UofALogo.png";
    }

    if(this.theSchoolChoice.equals("Harvard University")){

    }
    return theImage;
}

JSF Code:

    <h:selectOneMenu value="#{person.theSchoolChoice}" style="width : 179px; height : 21px;">
        <f:selectItems value="#{person.theOptions}"/>
    </h:selectOneMenu>
    <h:outputLabel value="  "/>

    <h:commandButton action="submit" value="Get templates" style="FONT-SIZE: medium; FONT-FAMILY: 'Rockwell';width : 128px; height : 25px;">
    <f:ajax event="change" render="image" />
    </h:commandButton>
    <br></br>
    <br></br>
    <h:graphicImage id="image" value="#{person.theImage}"/>
  • 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-16T11:03:40+00:00Added an answer on May 16, 2026 at 11:03 am

    As told in your first question about the subject, I have suggested to get hold of all images in a Map<String, List<String>> where the map key is the dropdown value and the map value is the collection of images.

    Since you can’t seem to figure it out, here’s a kickoff example how the JSF page should look like:

    <h:form>
        <h:selectOneMenu value="#{bean.groupName}">
            <f:selectItem itemValue="Please select one" />
            <f:selectItems value="#{bean.groupNames}" />
            <f:ajax event="change" render="images" />
        </h:selectOneMenu>
        <h:panelGroup id="images">
            <ui:repeat value="#{bean.images}" var="image">
                <h:graphicImage value="#{image}" /> 
            </ui:repeat>
        </h:panelGroup>
    </h:form>
    

    And here’s how the associated Bean should look like:

    @ManagedBean
    @ViewScoped
    public class Bean {
    
        private Map<String, List<String>> allImages = new LinkedHashMap<String, List<String>>();
        private List<String> groupNames;
        private String groupName;
    
        public Bean() {
            allImages.put("group1", Arrays.asList("group1a.jpg", "group1b.jpg", "group1c.jpg"));
            allImages.put("group2", Arrays.asList("group2a.jpg", "group2b.jpg", "group2c.jpg"));
            allImages.put("group3", Arrays.asList("group3a.jpg", "group3b.jpg", "group3c.jpg"));
            groupNames = new ArrayList<String>(allImages.keySet());
        }
    
        public List<String> getImages() {
            return allImages.get(groupName);
        }
    
        public List<String> getGroupNames() {
            return groupNames;
        }
    
        public String getGroupName() {
            return groupName;
        }
    
        public void setGroupName(String groupName) {
            this.groupName = groupName;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 502k
  • Answers 502k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Problem solved (to a point). I was running 64 bit… May 16, 2026 at 2:32 pm
  • Editorial Team
    Editorial Team added an answer Use the keyword "debugger;" to attempt invoking a hard breakpoint.… May 16, 2026 at 2:32 pm
  • Editorial Team
    Editorial Team added an answer Make sure you have #included the header file for QVector… May 16, 2026 at 2:32 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a database table which holds meta data about images, the field in
I'm working on a simple image tagging and searching app. I've got my images
I've tried to search for an answer to this but I'm not having any
I have a JTable instance, containing a number of rows. The columns in this
this is my Question extension to this Question .. Here I am able to
I have my own custom Content Provider that loads a database which contains the
Im extending the UIButton Class to be able to set the font and color
Okay, so I'm going to take the off chance that someone here has used
This may be a little confusing but I having some trouble. My goal is
I'm writing an application which as part of it draws an image on a

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.