Hello,

I am trying to create my first validation. I have two problems:

First one:

I want to use Vequieredstring validator. The problem is that my application is 
not complaining if I do leave the input field empty.

Here is my code:

reqisterqa.jsp (Only the form is needed here, I assume)

            
            
                        
               



struts.xml


         
                 /jsp/forms/registerqa.jsp
                  /jsp/forms/registerqa.jsp
            /jsp/forms/registerqa.jsp
  




RegisterQAForm-validator.xml



  
    
      true
      Heading is required
    
  




RegisterQAForm class

package org.nicsoft.application.mobiletraining.qa;

import java.io.IOException;
import java.util.Map;
import org.apache.struts2.interceptor.ParameterAware;
import com.opensymphony.xwork2.ActionSupport;

public class RegisterQAFormAction extends ActionSupport implements 
ParameterAware  {

    public String message;
    public String heading;
    
    Map param;
    
    public String execute() throws Exception {
        
        System.out.println(param.get("heading")[0]);
        System.out.println(param.get("answer")[0]);
        QAHandler handleQA = new QAHandler();
        handleQA.storeQA(param);
        
        setMessage("Ärende " + param.get("heading")[0] + " registrerat");       
 
        if (getHeading() != null){
              return SUCCESS;
            }
            else{
              return ERROR;
            }
    }
    
    public void setParameters(Map param) {
        this.param = param;
        
    }    
    
    public void setMessage(String message){
         this.message = message;
    }

    public String getMessage() {
         return message;
    }    
    
    public void setHeading(String heading){
        this.heading = heading;
    }
    
    public String getHeading(){
        return this.heading;
    }
}


I did put the RegisterQAForm-validator.xml in the same package as the class 
RegisterQAForm. Also tried to put it in the root/default package, no difference.

Can anyone tell me what is the problem?

My second problem:

I also want to use the Field Validator at some point. But it's some problem 
with the AbstractValidationActionSupport class. It isn't found. Anyone knows 
where this class is located? Couldn't find it in XWork where I though it's 
supposed to be. 

Thank you in advance!

Regards,
Niklas


_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to