This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

changed properties of form bean

 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does struts provide any way to find which properties of form bean has modified?

I tried to find answer on net but failed.

Let me explain my problem:
I have a form bean with three member variables.
I chances are that user may submit the form without changing any one of these values.
If user has not changed any of these values then I want to do call method1().
I dont want to keep old values in session and then compare with latest and then call method1().
If struts keep old values somewhere or directly let me know that which are properties of form bean has changed then it will be great feature of struts.

Does such feature exist?
 
Sagar Rohankar
Ranch Hand
Posts: 2906
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by R K Singh:


Does such feature exist?


As far as my knowledge is concerned, the answer is No !! May be we need to find out some ActionFormListener, which gets called when some bean states gets changed ..

I would like to suggest some alternative, like

Why don't you keep a check box, which ask user to click, If you want to change this values, and check it If its value is true. That's the one way you can know that user wished to change values.. But there is some cons to this solution , Suppose user click the box, but doesn't change the values...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neither Struts 1 nor 2 have this feature. You need to do this type of comparison yourself.
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks David and Sagar for inputs.
 
Sagar Rohankar
Ranch Hand
Posts: 2906
1
Java Spring Ubuntu
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic