File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes changed properties of form bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "changed properties of form bean" Watch "changed properties of form bean" New topic
Author

changed properties of form bean

R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
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?


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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...


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Neither Struts 1 nor 2 have this feature. You need to do this type of comparison yourself.
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Thanks David and Sagar for inputs.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

You are welcome
 
 
subject: changed properties of form bean