Oops.

Question-validation.xml
<!DOCTYPE validators PUBLIC 
"-//OpenSymphony Group//XWork Validator 1.0.2//EN" 
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";>

<validators>
    <field name="username">
        <field-validator type="requiredstring">
            <message>Username is required</message>
        </field-validator>
    </field>
    <field name="q1">
        <field-validator type="requiredstring">
            <message>Please answer q1</message>
        </field-validator>
    </field>
</validators>

Here are snippets from the action
ActionQuestion.java
public class ActionQuestion extends ActionSupport {

        public String execute() throws Exception {
        System.out.println(this.getClass().getName() + ".execute() start");
        log.trace("starting");
        System.out.println("q1=" + getQ1());
        
        Question l_question = new Question("this is my question",
QuestionType.MULTIPLE_CHOICE);
        l_question.addAnswer(new Answer("a9", "Answer first"));
        l_question.addAnswer(new Answer("a1", "Answer 1"));
        l_question.addAnswer(new Answer("a2", "Answer 2"));
        l_question.addAnswer(new Answer("a3", "Answer 3"));
        l_question.addAnswer(new Answer("a4", "Answer 4"));
        l_question.addAnswer(new Answer("a0", "Answer last"));
                setQuestion(l_question);
                
                HashMap l_map = new HashMap(10);
                l_map.put("x1", "Answer x1");
                l_map.put("x2", "Answer x2");
                l_map.put("x3", "Answer x3");
                l_map.put("x4", "Answer x4");
                l_map.put("x5", "Answer x5");
                setMap(l_map);
                
        System.out.println(this.getClass().getName() + ".execute() end");
    return SUCCESS;
}

There is no validate() in my action.




  _____  

Mitch Claborn

[EMAIL PROTECTED]



-----Original Message-----
From: Dave Newton [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 11, 2007 1:23 PM
To: Struts Users Mailing List
Subject: Re: Validation not validating


--- Mitch Claborn <[EMAIL PROTECTED]> wrote:
> Seems like the validation is not firing.
> What am I missing?

Without any validation files and / or action files
it's kind of hard to say.

If you post your validation file (the tutorial uses an
XML config) that might be enough; posting your Action
file as well will remove one more point where things
could go wrong.

d.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System for
Cedar Creek Software. 
______________________________________________________________________


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to