• +91 9723535972
  • info@interviewmaterial.com

Struts Interview Questions and Answers

Question - Can you give me a simple example of using the requiredif Validator rule?

Answer - First off, there's an even newer Validator rule called validwhen, which is almost certainly what you want to use, since it is much easier and more powerful. It will be available in the first release after 1.1 ships. The example shown below could be coded with validwhen as: test ((((sex == 'm') OR (sex == 'M')) AND (*this* == null)) OR (*this* != null)) Let's assume you have a medical information form with three fields, sex, pregnancyTest, and testResult. If sex is 'f' or 'F', pregnancyTest is required. If pregnancyTest is not blank, testResult is required. The entry in your validation.xml file would look like this: field[0] sex fieldTest[0] EQUAL fieldValue[0] F field[1] sex fieldTest[1] EQUAL fieldValue[1] f fieldJoin OR

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners