> I am new to Struts 2 and use annotation driven validations and they are > working correctly. The only issue I have is that the validations are > performed even upon navigating to my action for the first time. > > Ie All the fields on the web form are initially blank and also all my error > msgs from several @RequiredString fields are also displayed. > > Is there is simple way to prevent error msgs when the action is initially > navigated to? >
If you have CRUD style actions you annotate the action methods that don't need validation with @SkipValidation. For example my CRUD actions might have doNew() , doCreate(), doEdit(), and doUpdate() methods and I will add the @SkipValidation to doNew() and doEdit() like this: @SkipValidation public String doNew(){...} public String doCreate(){...} @SkipValidation public String doEdit(){...} public String doUpdate(){...}