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

  • Home
  • SEARCH
  • 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 7910723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:58:43+00:00 2026-06-03T12:58:43+00:00

I want to do something like this, where Foo is a class with one

  • 0

I want to do something like this, where Foo is a class with one String field name, and getter/setter:

<form:form id="frmFoo" modelAttribute="foos">
   <c:forEach items="${foos}" var="foo">
     <form:input path="${foo.name}" type="text"/>

And then submit the complete list of Foos with updated names?

My controller looks like this:

@RequestMapping(value = "/FOO", method = RequestMethod.POST)
public String getSendEmail(List<Foo> foos, Model model) {
    // ...
}
  • 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-03T12:58:45+00:00Added an answer on June 3, 2026 at 12:58 pm

    Maybe this answersyour question:

    CONTROLLER :

    @Controller("/")
    public class FooController{
    
        //returns the ModelAttribute fooListWrapper with the view fooForm
        @RequestMapping(value = "/FOO", method = RequestMethod.GET)
        public String getFooForm(Model model) {
            FooListWrapper fooListWrapper = new FooListWrapper();
            fooListWrapper.add(new Foo());
            fooListWrapper.add(new Foo());
    
            //add as many FOO you need
    
            model.addAttribute("fooListWrapper", fooListWrapper);
    
            return "fooForm";
        }
    
        @RequestMapping(value = "/FOO", method = RequestMethod.POST)
        public String postFooList(@ModelAttribute("fooListWrapper")FooListWrapper fooListWrapper, Model model) {
    
            //...........
        }
    
    }
    

    FOO LIST WRAPPER :

    public class FooListWrapper {
        private List<Foo> fooList;
    
        public FooListWrapper() {
             this.fooList = new ArrayList<Foo>();
        }
    
        public List<Foo> getFooList() {
            return fooList;
        }
    
        public void setFooList(List<Foo> fooList) {
            this.fooList = fooList;
        }
    
        public void add(Foo foo) {
            this.fooList.add(foo);
        }
    }
    

    FOO CLASS :

    public class Foo {
        private String name;
    
        public Foo() {
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    }
    

    JSP VIEW (name = fooForm):

    <c:url var="fooUrl" value="/FOO"/>
    <form:form id="frmFoo" action="${fooUrl}" method="POST" modelAttribute="fooListWrapper">
    
    
        <c:forEach items="${fooListWrapper.fooList}" varStatus="i">
               <form:input path="fooList[${i.index}].name" type="text"/>
        </c:forEach>
    
    
        <button>submit</button>
    </form:form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to do something like this: class Cls { function fun($php) { return
I want to achieve something like this: class C { int m_nVal; public: C(int
I've trying to achieve something like this: class Base { public: Base(string S) {
I want to do something like this to call a JSP 2.0 tag: <mytags:foo
I want something like this: abcdab.search(/a/g) //return [0,4] Is it possible?
I want to do something like this within an MS Access query, but SUBSTRING
i want to do something like this: Transcript show: '\n'. how?
I want to do something like this: cat abcd.txt | cut -f 2,1 and
I want to do something like this create type Item as object ( id
I want to do something like this with a GridView: <asp:CommandField ShowSelectButton=True Visible='<%# return

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.