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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:07:14+00:00 2026-05-16T04:07:14+00:00

I have an object in my Action class which contains an arraylist of objects

  • 0

I have an object in my Action class which contains an arraylist of objects internally, I am trying to create a CRUD screen for this object. My Action Class and bean are given below,

/**
 * @author rohit
 *
 */
public class IRFeedMgmtAction extends ActionSupport implements ModelDriven<IRFeeds>,SessionAware,ServletRequestAware {

private static org.apache.log4j.Logger log = Logger.getLogger(IRFeedMgmtAction.class);

private HttpServletRequest request;

private Map session;

private IRAccountsDAO acctsDAO;

private IRFeeds feed = new IRFeeds();

/* (non-Javadoc)
 * @see com.opensymphony.xwork2.ActionSupport#execute()
 */
public String execute()
{
    return "success";
}

/**
 * @return
 */
public String add()
{
    IRUser user  = (IRUser) session.get("user");

    List<IRAccountUsers> twtUsers =  acctsDAO.getTwitterAcctByOrgId(user.getOrgId());
    feed.setTwtAccts(prepareTwitterAccounts(twtUsers));

    return "addFeed";
}

/**
 * @return
 */
public String save()
{
    IRFeeds fd = getFeed();
    ArrayList<IRFeedAccts> twtAccts = fd.getTwtAccts();

    System.err.println(fd.getFeedUrl());

    for (Iterator iterator = twtAccts.iterator(); iterator.hasNext();) 
    {
        IRFeedAccts irFeedAccts = (IRFeedAccts) iterator.next();
        System.err.println(irFeedAccts.getNumber());
    }

    return "saved";
}

/**
 * @return 
 * 
 */
private ArrayList<IRFeedAccts> prepareTwitterAccounts(List<IRAccountUsers> twtUsers)
{
    ArrayList<IRFeedAccts> twtAccts = new ArrayList<IRFeedAccts>();
    IRAccountUsers twtUser = null;
    IRFeedAccts feedAccnt = null;
    for (Iterator iterator = twtUsers.iterator(); iterator.hasNext();)
    {
        twtUser = (IRAccountUsers) iterator.next();

        feedAccnt = new IRFeedAccts();
        feedAccnt.setAccountId(twtUser.getSocialId());
        feedAccnt.setPic(twtUser.getPic());
        feedAccnt.setName(twtUser.getTwtUsrName());
        feedAccnt.setNumber(30);

        twtAccts.add(feedAccnt);
    }

    return twtAccts;
}

MY BEAN

public class IRFeeds  implements java.io.Serializable {


 private Integer feedId;
 private Integer campId;
 private String feedUrl;
 private boolean active;
 private Date createdOn;
 private Date updatedOn;
 private String createdBy;

 private ArrayList<IRFeedAccts> twtAccts; 

 private ArrayList<IRFeedAccts> fbAccts;

 private ArrayList<IRFeedAccts> fbPages;

MY JSP FILE

<s:iterator value="#session.fd.twtAccts" status="twtAcct">
            <tr>
                <td>
                    <div style="width: 48px; float: left;"><img src="<s:property value="pic" />" /></div>
                    <div style="text-align: left;"><s:property value="name" /></div>
                </td>
                <td>
                    <s:textfield name="number"/>
                </td>
                <td>
                    <input type="text" /> 
                </td>
                <td>
                    <s:textfield name="signature"/> 
                </td>
            </tr>
            </s:iterator>

Now my problem is when the value of the beans in the arraylist is modified in the JSP, the same doesn’t reach the action class save method. The value remains the same.

Regards,
Rohit

  • 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-16T04:07:15+00:00Added an answer on May 16, 2026 at 4:07 am

    Solve this issue

    <s:iterator id="twtFeedAccts" value="twtFeedAccts" status="twtAcct">
                <tr>
                    <td width="250">
                        <img src="<s:property  value="%{twtFeedAccts[#twtAcct.index].pic}" />"  width="25px" height="25px"  />
                            <s:property  value="%{twtFeedAccts[#twtAcct.index].name}" />
    
                    </td>   
                    <td width="200">
                        <s:textfield id="twtFeedAccts[%{#twtAcct.index}].number" name="twtFeedAccts[%{#twtAcct.index}].number" value="%{twtFeedAccts[#twtAcct.index].number}" />
                    </td>
                    <td width="200">
                        <s:select id="twtFeedAccts[%{#twtAcct.index}].cycle" name="twtFeedAccts[%{#twtAcct.index}].cycle" value="%{twtFeedAccts[#twtAcct.index].cycle}"
                         label="Select a month"  list="#{'2':'2 hrs','4':'4 hrs', '6':'6 hrs', '12':'12 hrs', '24':'24 hrs'}" />
                    </td>
                    <td width="250">
                        <s:textfield id="twtFeedAccts[%{#twtAcct.index}].signature" name="twtFeedAccts[%{#twtAcct.index}].signature" value="%{twtFeedAccts[#twtAcct.index].signature}" size="40"/>
                    </td>
                    <td width="50">
                        <s:checkbox id="twtFeedAccts[%{#twtAcct.index}].selected" name="twtFeedAccts[%{#twtAcct.index}].selected" value="%{twtFeedAccts[#twtAcct.index].selected}"  />
                    </td>
                </tr>
                </s:iterator>
    

    When you submit the form the beans will go populated.

    Regards,
    Rohit

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

Sidebar

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.