struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Umesh Awasthi <umeshawas...@gmail.com>
Subject Re: Strange issue with Model driven and Bean validation
Date Tue, 15 Oct 2013 13:45:01 GMT
Dave,

i am agree with you, i just followed doc and than it started giving me some
strange issues in validations.
I tried to debug underlying API but with no success.

On doing some more Googling i came across create new instance outside
getModel() and it started working as expected.

Thanks
Umesh


On Tue, Oct 15, 2013 at 7:01 PM, Dave Newton <davelnewton@gmail.com> wrote:

> Wouldn't this return a new ProfileDTO every single time getModel() is
> called?
>
> This, in turn, would mean that if you were validating model.foo and
> model.bar that it'd be called twice.
>
> I have not verified this, perhaps there's some magic (e.g., spooky) caching
> happening somewhere, but to my mind, without some very clear documentation,
> instantiating the model object in the getter would probably be wrong.
>
> Dave
>
>
>
> On Tue, Oct 15, 2013 at 5:38 AM, Umesh Awasthi <umeshawasthi@gmail.com
> >wrote:
>
> > Hi All,
> >
> > I am facing a strange issue while trying to validate a bean using bean
> > validation.I am using model driven interface to pass form field values to
> > Action and here is the  action code
> >
> > public class ModelDriven extends ActionSupport implements
> > com.opensymphony.xwork2.ModelDriven<ProfileDTO>{
> >
> >
> >  @Valid
> >     public ProfileDTOgetModel()
> >     {
> >          return new ProfileDTO();
> >     }
> > }
> >
> > Though bean validator is validating fields but skipping few of them an di
> > am clueless why it is dong this, when i am using simple process without
> > Model driven every validation is working as expected.
> >
> > There is no difference in code and only line of code different is in
> action
> > for model driven.
> >
> > Not sure how relevant question is , but do we need to take care any
> > specific issue while using model driven approach?
> >
> > --
> > With Regards
> > Umesh Awasthi
> > http://www.travellingrants.com/
> >
>
>
>
> --
> e: davelnewton@gmail.com
> m: 908-380-8699
> s: davelnewton_skype
> t: @dave_newton <https://twitter.com/dave_newton>
> b: Bucky Bits <http://buckybits.blogspot.com/>
> g: davelnewton <https://github.com/davelnewton>
> so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
>



-- 
With Regards
Umesh Awasthi
http://www.travellingrants.com/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message