Can we change the validator-rules.xml for our own
validations in struts??



Can we change the validator-rules.xml for our own validations in struts??..

Answer / Manish Prasad

In Struts, you can customize validation rules by creating your own Validator classes and adding them to the Validation.xml file. Here's how:

1. Create a new Validator class that extends ActionValidator and implements the required methods (validate(), getValidationErrors()).
2. Define the validation rules for your custom Validator in the Validation.xml file, including the name of your Validator class and any necessary properties.
3. Configure your action classes to use your custom Validator by adding a validate() method that initializes and uses an instance of your Validator class.
4. Test your custom validation by submitting forms with invalid data and verifying that the correct error messages are displayed.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More J2EE Code Interview Questions

Write Down Steps Using SAX Parser

1 Answers   IBM,


how to display after one month adding today's sysdatedate in jsp?

1 Answers  


exception org.apache.jasper.JasperException: java.lang.NullPointerException org.apache.jasper.servlet.JspServletWrapper.handleJs pException(JspServletWrapper.java:491) org.apache.jasper.servlet.JspServletWrapper.service( JspServletWrapper.java:419) org.apache.jasper.servlet.JspServlet.serviceJspFile( JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServ let.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.j ava:717) root cause java.lang.NullPointerException org.apache.struts.taglib.TagUtils.retrieveMessageRes ources(TagUtils.java:1175) org.apache.struts.taglib.TagUtils.message(TagUtils.j ava:1038) org.apache.struts.taglib.bean.MessageTag.doStartTag( MessageTag.java:224) org.apache.jsp.register_jsp._jspx_meth_bean_005fmess age_005f0(register_jsp.java:138) org.apache.jsp.register_jsp._jspService(register_jsp .java:94) org.apache.jasper.runtime.HttpJspBase.service(HttpJs pBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.j ava:717) org.apache.jasper.servlet.JspServletWrapper.service( JspServletWrapper.java:377) org.apache.jasper.servlet.JspServlet.serviceJspFile( JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServ let.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.j ava:717)

1 Answers  


How to run the Result Intemation System project in java for collage student in which result of internal exam marks send on parents mobile using SMS? what software required to run this project? please reply immediately...

1 Answers  


How to get one hasmap value in another hashmap ,only value not key

1 Answers   CTS,


Can you forward data from a servlet to a regular .java class that is not a servlet?

3 Answers  


Do you think about CMM(Capability Maturity Model) process?

1 Answers   Amazon,


i am trying to intigrate ejb and hibernate ,from session facade i am callind dao implemented through hibernate,i am getting a ClassDefNotFoundException for this org/hibernate/Session i ve set the class path at build path and in setEnv in weblogic still .........

1 Answers  


How to convert string containing decimal point into integer in java? For example given a string like "3.14" as input how to get integer 3 as result.

7 Answers  


how to find reverse of string without string funtion of java.

2 Answers  


code inside filter to restrict users to access a servlet component .

1 Answers   NIIT,


How to read MS-word document in java without displaying junk (unnecessary) data?

5 Answers   Cognizant,


Categories