Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2: Retern all the values inside the list in my Action

 
Paul Michael Serrano
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Day,

I have an ArrayList (wcAlerts - with getter and setter) in my action. I could properly display all the values inside my list with this code in my JSP



My question is, if I change my checkbox or dropdown list, could I get the all values within my iterator (wcAlerts will be updated)?

Thanks,
Paul
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Paul,

The only thing that is carried back to the action would be your "name" attirbute and nothing else... (only if you have the setMethod of the variable) your list wont reflect any changes that you have done... so I doubt...
 
Paul Michael Serrano
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Robin,

I guess you are right... I've tried debugging it through eclipse, and when I looked at the value of my ArrayList (wcAlerts --> I do have getter and setter for this ArrayList) it is null. All the while I thought OGNL will handle this for us. The only visible variables to me are the variables outside wcAlerts arrayList. Anyway, does anyone have an idea how could I get the values from the form? I was thinking to create a FormBean that could get all the values from the jsp and create a temporary container for the value of my ArrayList(wcAlerts) I'll just remove my <s:iterator> tag.

Any suggestions are open.

Thanks,
Paul
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic