Struts 2 validate specific action in xml

前端 未结 3 503
鱼传尺愫
鱼传尺愫 2021-01-26 13:30

I want to validate specific method only in action class. Action method is this.

public String add() throws Exception {

         


        
3条回答
  •  情深已故
    2021-01-26 13:58

    I had similar problems but then these are couple of things that i rectified :

    1) DOCTYPE in the yourAction-yourAlias-validation.xml should be

        
    

    2)Created a custom interceptor to exclude the methods that need not be validated.Below is a sample for my candidate registration where i had to skip validation for district method which fetched districts for a state.

     
      
       
         input,district
        
      
    
    
    
    
                
                
                    /jsps/student/studentregistration.jsp
                    /jsps/student/registrationfailure.jsp
                    /jsps/login.jsp
                    /jsps/includes/dropdown_districts_regoffice.jsp
                
            
    

提交回复
热议问题