You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by damuchinni <da...@gmail.com> on 2009/08/25 04:43:24 UTC

how to check values of bean is modified in a form

Hi ,

is there any predefined method for checking whether bean value is modified
with previous value.

Please help me.

need to know in which version it is available

Thanks

Dam
-- 
View this message in context: http://www.nabble.com/how-to-check-values-of-bean-is-modified-in-a-form-tp25126457p25126457.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: how to check values of bean is modified in a form

Posted by Chris Pratt <th...@gmail.com>.
Which is why most of the time it just makes sense to update the values that
are supplied.
  (*Chris*)

On Mon, Aug 24, 2009 at 11:10 PM, damuchinni <da...@gmail.com> wrote:

>
> I appricate for ur suggestion, thanks a lot.
>
> but
>
> This type of approach will use only if a form have one or two parameters ,
> but if ofrm have more than 20 parameters and like that there 20 to 30 forms
> then, it will become redendunt to write such check mehtods for every form
> parameters.
>
> so Please can any one provide me better approach.
>
> Thanks
> Dam
>
> Chris Pratt wrote:
> >
> > Normally, it's just easiest to update all the values and if they haven't
> > changed, no harm, no foul.  But if you need to, you can put a check in
> the
> > parameter mutators of the action.  Something like:
> >
> > private Bean bean;
> >
> > public void setName (String name) {
> >   if(!name.equals(bean.getName())) {
> >     bean.setModified(true);
> >   }
> > }
> >
> > (*Chris*)
> >
> > On Mon, Aug 24, 2009 at 7:43 PM, damuchinni <da...@gmail.com>
> wrote:
> >
> >>
> >> Hi ,
> >>
> >> is there any predefined method for checking whether bean value is
> >> modified
> >> with previous value.
> >>
> >> Please help me.
> >>
> >> need to know in which version it is available
> >>
> >> Thanks
> >>
> >> Dam
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/how-to-check-values-of-bean-is-modified-in-a-form-tp25126457p25126457.html
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/how-to-check-values-of-bean-is-modified-in-a-form-tp25126457p25128901.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: how to check values of bean is modified in a form

Posted by Dave Newton <ne...@yahoo.com>.
damuchinni wrote:
> This type of approach will use only if a form have one or two parameters ,
> but if ofrm have more than 20 parameters and like that there 20 to 30 forms
> then, it will become redendunt to write such check mehtods for every form
> parameters.
> 
> so Please can any one provide me better approach.

Create a hash.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: how to check values of bean is modified in a form

Posted by damuchinni <da...@gmail.com>.
I appricate for ur suggestion, thanks a lot.

but 

This type of approach will use only if a form have one or two parameters ,
but if ofrm have more than 20 parameters and like that there 20 to 30 forms
then, it will become redendunt to write such check mehtods for every form
parameters.

so Please can any one provide me better approach.

Thanks 
Dam

Chris Pratt wrote:
> 
> Normally, it's just easiest to update all the values and if they haven't
> changed, no harm, no foul.  But if you need to, you can put a check in the
> parameter mutators of the action.  Something like:
> 
> private Bean bean;
> 
> public void setName (String name) {
>   if(!name.equals(bean.getName())) {
>     bean.setModified(true);
>   }
> }
> 
> (*Chris*)
> 
> On Mon, Aug 24, 2009 at 7:43 PM, damuchinni <da...@gmail.com> wrote:
> 
>>
>> Hi ,
>>
>> is there any predefined method for checking whether bean value is
>> modified
>> with previous value.
>>
>> Please help me.
>>
>> need to know in which version it is available
>>
>> Thanks
>>
>> Dam
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-check-values-of-bean-is-modified-in-a-form-tp25126457p25126457.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-check-values-of-bean-is-modified-in-a-form-tp25126457p25128901.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: how to check values of bean is modified in a form

Posted by Chris Pratt <th...@gmail.com>.
Normally, it's just easiest to update all the values and if they haven't
changed, no harm, no foul.  But if you need to, you can put a check in the
parameter mutators of the action.  Something like:

private Bean bean;

public void setName (String name) {
  if(!name.equals(bean.getName())) {
    bean.setModified(true);
  }
}

(*Chris*)

On Mon, Aug 24, 2009 at 7:43 PM, damuchinni <da...@gmail.com> wrote:

>
> Hi ,
>
> is there any predefined method for checking whether bean value is modified
> with previous value.
>
> Please help me.
>
> need to know in which version it is available
>
> Thanks
>
> Dam
> --
> View this message in context:
> http://www.nabble.com/how-to-check-values-of-bean-is-modified-in-a-form-tp25126457p25126457.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>