Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Multiselect to Hidden Field

 
Andy Lileston
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

I'm using a the struts select tag for use with multiple select. Like so:



The corresponding bean property is a . I'm submitting that form and on the other side, I am wanting to put that data into a hidden field. Right now, it just puts the object.toString() gobbledygook in for the value. It seems that struts should be able to handle this transparently.
 
Tom Rispoli
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to display the value of the string array with an html:hidden tag that is inside of a logic:iterate loop? It sounds like you may NOT be, and the single html:hidden tag is just going to try to display the toString of your array. So you may want to try using an iterate tag to loop through the values. I may be making a bad guess though. It might help to see your getter and setter methods and the jsp code you are using to try to display the value.
 
Andy Lileston
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right Tom. I'm not iterating through them, but if I have to, that just seems like bonehead design. I would think that Struts would be able to handle it all transparently. I guess not.

Does anyone have some sample code of a Collection property iteration? I played around with it a bit, but the 'indexed' attribute kept giving me trouble.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic