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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:15:14+00:00 2026-06-04T13:15:14+00:00

I am using Struts2. I have a hashset in my pojo. I am trying

  • 0

I am using Struts2. I have a hashset in my pojo. I am trying to submit values to the hashset. There is no way i can change my collection type to list.

here is pojo

Item{
Set<Person> personCollection;
long itemCode;

    public void setItemCode(long itemCode)
    {
        this.itemCode=itemCode;
    }
    public long getitemCode()
    {
        return itemCode;
    }
    public void setPersonCollection(Set<Person>personCollection)
    {
        this.personCollection=personCollection;
    }
    public Set<Person> getPersonCollection()
    {
        return personCollection;
    }
}

Person{
    String name;
    public void setName(String name)
    {
        this.name=name;
    }
    public String getName()
    {
        return name;
    }
}

Action

SubmitItemAction
{
     private Item item;
     public getItem()
     {
          return item;
     }
     public setItem(Item item)
     {
          this.item=item;
     }
     public String submitItem()
     {
           dao.submit(item);
     }
}

jsp

  <s:text name=item.personCollection[0].name/>
  <s:text name=item.personCollection[1].name/>

so this doesnt work. When i submit my jsp with above snippet it gives error, its not able to populate personCollection from Item.

So what should be naming convention in jsp. Like if personCollection would have been a list I could have used item.personCollection[0].someProperty. But how do you set the name for collection of type set.

  • 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-04T13:15:16+00:00Added an answer on June 4, 2026 at 1:15 pm

    Well in your submit action use the list and then you can use this list inside jsp with index.

    You cannot use set here as set cannot be accessed using indexes

    In your business logic convert the list into set as you may require set for further orm.

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

Sidebar

Related Questions

I'm Using Struts2 in jsp page i have iterator values for checkbox. how to
I have a Struts2 webapp, in which I compiled using the Tomcat 5.5 libraries.
Hi i am using struts2 and hibernate in my project. When i am trying
I am new to struts2, prior to this I have been using struts1.2, Spring
I have struts2 application with struts2 version 2.0, There is no error on server
I am trying to build a login page using hibernate and struts2. My design
we are using Struts2 in our code and I have scenario where I need
I am using struts2 in my project. Have to generate image in my action
I am using struts2 for developing a web application. I have include the required
Im using Struts2 and Hibernate, trying to create a simple form to edit an

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.