• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is it possible to stop the strut validation in validation rule method?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have four fields in my jsp for that I have the different validation now I have added on more field for that I have written my own custom validation rule but now I want to stop the strut valuator for other four fields in my method.

Is it possible in strut?
Can any buddy have the answer?

If more information is needed then just let me know.

Thanks
Prafull
[ June 25, 2007: Message edited by: prafull kherde ]
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prafull,

As per my understanding of your query you want to stop the validation method call of the form bean. If I am correct then you can stop the validation from your struts-config.xml in the action tag mention validate=false for ex:-

<action path="/search"
type="com.struts.vinay.practice.minihr.core.SearchAction"
name="searchForm" scope="request" validate="true"
input="/SearchEmployeeForm.jsp" >

</action>
 
prafull kherde
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Guru,

You are closer to what I am asking but the difference is that I want to stop the validation after the validation goes to my custom validation rule method and it return false.

My code



Hope you understand my problem.

If still you are not getting the thing then just tell me the area where you are not able to understand.
I will try to clear that out.

Thanks
Prafull


[ June 25, 2007: Message edited by: prafull kherde ]
[ June 25, 2007: Message edited by: prafull kherde ]
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you want the following things to happen (?)
1) If data entered in 5th field ONLY that field to be validated OR
2) If data entered in any one of first 4 fields ALL 4 fields have to be validated.

Write 2 custom validator functions, one for each of the 2 cases above. You can define these validator functions in validation-rules.xml and validator.xml.

Hope that helps.
 
prafull kherde
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ud,

the real thing is that I have four field and I want it be validated first from my own validation if my validation rule is fail then it should not validate the other 3 fields. It should stop there and return the error that is from my validation rule.

Now the problem is that i am not able to stop the validation in my method as I quoted in comment.

Regards
Prafull
 
Ud Naik
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it not possible to have a boolean variable in the custom validator class and have your validation method for the other fields check that before performing the validation?

If this is not your requirement, maybe I am not able to understand exactly.
 
The fastest and most reliable components of any system are those that are not there. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic