• 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

Collection-backed radio button in Struts 2

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why is it that when a form with a collection-backed radio button gets submitted that Struts 2 calls the getter for the list?

For instance:


The code above calls "getPriorityList()" when I submit the form. I really only need the getter called when the form is being built.


I'm using Struts 2, version 2.2.1.1 and my action is both ModelDriven and Preparable.


Thanks in advance.
 
Kev Adams
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just checking in. Does anyone know the answer to this?
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
being built? AJAX?
 
Ranch Hand
Posts: 35
Hibernate jQuery Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to ParameterInterceptor in struts 2 which puts the request parameters on ValueStack so that OGNL can pull data.
 
Kev Adams
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Manuel Schenkhuizen wrote:being built? AJAX?



Not with AJAX. Because I am using a collection-backed radio button, the Collection which backs it is provides the data. So, the form is being "built" before it is displayed.

Rupesh Mhatre wrote:Thanks to ParameterInterceptor in struts 2 which puts the request parameters on ValueStack so that OGNL can pull data.



Yes, but the point of the original question is... Why does it NEED to call the getter method when you SUBMIT the form? It just needs to call the setter method (in my example, "setPriority").
 
Rupesh Mhatre
Ranch Hand
Posts: 35
Hibernate jQuery Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes in case of model driven only getModel method gets exposed. In this case we do create object of our domain model and struts2 interceptors only need to get the data from ValueStack. Hope this will resolve this query.
 
Kev Adams
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rupesh Mhatre wrote:Yes in case of model driven only getModel method gets exposed.



I mentioned in the original message that I was using ModelDriven. I'm not having a problem with that aspect of it.

Is there anyone else who understands what I'm asking? If not, I can try to explain it a different way.

 
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic