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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:09:46+00:00 2026-06-13T20:09:46+00:00

When i am keeping two inputs name same in jsp. I want they should

  • 0

When i am keeping two inputs name same in jsp. I want they should be come to controller in two different objects. @ModelAttribut

@RequestMapping(value = "/addUser", method = RequestMethod.POST)
public String addAdvertiser(@ModelAttribute("userInfoEntity") UserInfoEntity userInfoEntity,@ModelAttribute("addressEntity") AddressEntity personalAddress,@ModelAttribute("addressEntity") AddressEntity billingAddress){
// save this two address to my userInfo Entity 
// here i had one to many relationaship. from UserInfoEntity to AddressEntity
}

My JSP is as follows:

Personal Address
<div class="label"><b>Address 1 :</b></div>
                        <div class="leftSide"><input type="text" name="address1" class="textBox" style="width:250px;" /></div>

                        <div class="label"><b>City :</b></div>
                        <div class="leftSide"><input type="text" name="city" class="textBox" style="width:250px;" /></div>

                        <div class="label"><b>Zipcode :</b></div>
                        <div class="leftSide"><input type="text" name="zipcode" class="textBox" style="width:250px;" /></div>

                        <div class="label"><b>Address 2 :</b></div>
                        <div class="leftSide"><input type="text" name="address2" class="textBox" style="width:250px;" /></div>

                        <div class="label"><b>State :</b></div>
                        <div class="leftSide"><input type="text" name="state" class="textBox" style="width:250px;" /></div>

                        <div class="label"><b>Phone :</b></div>
                        <div class="leftSide"><input type="text" name="phone" class="textBox" style="width:250px;" /></div>




Billing Address
                        <div class="label"><b>Address 1 :</b></div>
                        <div class="leftSide"><input type="text" name="address1" class="textBox" style="width:250px;" /></div>

                        <div class="label"><b>City :</b></div>
                        <div class="leftSide"><input type="text" name="city" class="textBox" style="width:250px;" /></div>

                        <div class="label"><b>Zipcode :</b></div>
                        <div class="leftSide"><input type="text" name="zipcode" class="textBox" style="width:250px;" /></div>

                        <div class="label"><b>Address 2 :</b></div>
                        <div class="leftSide"><input type="text" name="address2" class="textBox" style="width:250px;" /></div>

                        <div class="label"><b>State :</b></div>
                        <div class="leftSide"><input type="text" name="state" class="textBox" style="width:250px;" /></div>

                        <div class="label"><b>Phone :</b></div>
                        <div class="leftSide"><input type="text" name="phone" class="textBox" style="width:250px;" /></div>

Please tell me the solution that how can i send two objects of same AddressEntity from jsp to controller keeping the same value for attribute “name” of input type.

In the given senario i am getting the object but it includes values of both address by “,”(comma) seperated.

  • 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-13T20:09:47+00:00Added an answer on June 13, 2026 at 8:09 pm

    We can find it in documentation, just read section about nesting properties.

    For provided case you need to set field names properly:

    user.address[0].city
    user.address[1].city
    user.address[2].city
    

    and same for the remaining.

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

Sidebar

Related Questions

My layout having two parts. I want to change the upper part by keeping
I am keeping three image views with 3 different images of the same height.
I want AddContentViewController to have two delegate, but keeping getting error, how can I
We are keeping our NuGet packages on a network folder. I want to update
I want code for keeping 1 second delay in Flex. i.e. i want to
I have two pages. Search page is the first page that takes user inputs.
I have two categories defined for the same class and have same function but
I need to build two version of same android app and install both on
Say I have the name of a file and it's full path in two
If two children have the same parent, how does an event firing from one

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.