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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:22:52+00:00 2026-06-11T13:22:52+00:00

I have a questionnaire form in which components (questions) are generated all programatically in

  • 0

I have a questionnaire form in which components (questions) are generated all programatically in my backing bean.

In form submit event I need to collect all user inputs and store them in db.

But JSF does not recognize the dymanically generated components and only finds the ones that are in my Facelets page which are my panelgrid and submit button. This is my submit() method.

   public boolean submit() {
        UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
        UIComponent formComponent = viewRoot.findComponent("mainForm");  //form id
        HtmlForm form = (HtmlForm)formComponent;
        List<UIComponent> componentList = form.getChildren();
        for(int p=0; p<componentList.size(); p++) {
            UIComponent component = componentList.get(p);
                System.out.println("The Component ID is:"+component.getId());
        }
        return true;
}

So does anyone know where I can hunt my components other than the method above?

  • 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-11T13:22:53+00:00Added an answer on June 11, 2026 at 1:22 pm

    This is not the right way to collect submitted values.

    You should instead bind the component’s value attribute to a bean property. E.g.

    UIInput input = new HtmlInputText();
    input.setId("input1");
    input.setValueExpression("value", createValueExpression("#{bean.input1}", String.class));
    form.getChildren().add(input);
    

    This way JSF will just update the bean property the usual way.

    private String input1; // +getter+setter
    
    public void submit() {
        System.out.println(input1); // Look, JSF has already set it.
    }
    

    You could make use of a Map<String, Object> property to bring some more dynamics.

    See also:

    • How to create dynamic JSF form fields
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a questionnaire in a form. In the end of it the submit
I have a simple questionnaire system which shows a random number of questions to
I have a form (a dynamically created questionnaire) with multiple questions. I have used
I have an MVC questionnaire app that loops through a set of questions <%
I have to write a website with JSP and Servlets which displays a questionnaire
We have a webapp performing questionnaire like scans. Entrance point is /app , which
I have an requirement where i need to fetch the form values. i'm able
I have div class called .stage which is a stage of a questionnaire <div
I have a custom UITableViewCell that has a UISegmentedControl object. My UITableView (questionnaire form)
I have a very simple HTML form on a PHP page for a questionnaire.

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.