• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem while seting properties of beans in collections in formulat

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I encountered recently problem I am not able to solve.
I have an JSP page, using struts to build an form. In the form I hawe some text boxes in which i am writing som properties of some beans that i store in collections. When i change the fields in the form (i put there some values) and submit the form and redisplay the same page the values are unchanged. If I change some property of the bean (connected to the form) that is not collection than it is working as it should, but the properties that are in collections do not change

example


I put some instances of Field into myField

then i write the numbers into the html:text boxes in the jsp page. I change someof them, redisplay the page (on chceck the values in the ActionClass for this form) and the values are the same.
If I change the name field in the jsp, the value changes. But not the values of the beans stored in enumeration

form example


after changing all the fields and forwarding to the same page, the only values that changes is the the name property of the formBean. The numbers (corectly displaying the value) property are the same... unchanged.

Am I doing something wrong or have I missed something in the struts ?

Thanks for answer
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the Web Frameworks forum.
 
Marek Lapin
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I solved my problem by switching to "nested" struts extensions.

All though I had to convert ale my collections to indexed (I used Set, now I am using Array)

Is there a mean to use with nested struts extension non-indexed collections ?
I have not found iny information about the use of indexed or non-indexed collections anywhere when studying nested extensions, so I am wondering whether i missed something or it is just not mensioned anywhere.
 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

You can use a "Set" only if you need to display values in the view. If an update of these values, back to the form, is required, there seems to be no option but to use arrays, Lists or Maps. I guess the "index" is the only way to identify which data in the collection has been updated.

Sheldon
 
reply
    Bookmark Topic Watch Topic
  • New Topic