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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:54:44+00:00 2026-05-27T11:54:44+00:00

All – New to struts2 here.. I’ve been reading some tutorials, and even picked

  • 0

All –

New to struts2 here.. I’ve been reading some tutorials, and even picked up a book so I understand some, but please forgive me if I use the wrong terms.

I’m looking for an example or an explanation on how to create a dynamic list of text fields based on a collection, have the user enter some input and then assign that input back to the object.

Example:

I have a dynamic set of products, I’d like to be able to display a table of product names and textfields where the user can enter a price for that product.

Product1 ....... [ textfield_price1 ]
Product2 ....... [ textfield_price2 ]
...
ProductN

[submit_button ]

How do I then map those textfield values back to each product, most of the examples I have seen are standard forms with static information.

Can anyone point me to the right place ?

Thanks in advance.

  • 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-27T11:54:45+00:00Added an answer on May 27, 2026 at 11:54 am

    Typically you’d use map-based syntax, usually with an ID as the key, and a domain object as the value. This is covered in the type conversion docs.

    Nutshell: the action has a map of { ID => Product } for the form data:

    public Map<Long, Product> getProductMap() { ... }
    // and setter, and private property
    

    Use [] in the JSP with an ID as thename` attribute value:

    <s:textfield name="productMap[%{id}]" ... />
    

    You could iterate over a collection of products, a pre-filled map, etc.

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

Sidebar

Related Questions

All I know about the constraint is it's name ( SYS_C003415 ), but I
All, I have some script tags that are not working in Wordpress. If I
All the examples of use and tutorials I have found on beginBackgroundTaskWithExpirationHandler: show how
All, I'm using wordpress with this and for some reason the eventDrop stopped working.
All along I've been testing on an Android 2 version ported to x86 (which
all, I am trying to multiply a matrix to a vector in OpenGL, but
All, This is a follow up for my question here . My setup: Visual
all. I'm a very, very new programmer. My language of choice at the moment
all! What is wrong with this code? I cannot understand what I am doing
all I want to show hide some ids using jQuery. My html code is

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.