Hi,

I'm having problems to show a error message with validation xml file.

This is the code in my struts.xml

        <action name="addNuevaSolicitud"
                class="es.mec.adesi.ctl.actions.solicitudes.TestAction">
            <result>/pages/opciones.jsp</result>
        </action>

The action class is this:

public class TestAction {

    private String dniParticipante;

    public String execute() {
        return Action.SUCCESS;
    }

    public String getDniParticipante() {
        return dniParticipante;
    }

    public void setDniParticipante(String dniParticipante) {
        this.dniParticipante = dniParticipante;
    }
}

And the validation file (TestAction-validation.xml) is:
<validators>
    <field name="dniParticipante">
        <field-validator type="required">
            <message>DNI is required</message>
        </field-validator>
    </field>
</validators>

In the jsp I have tried show the error message:
                    <div class="error"><s:actionerror /> <s:fielderror />
<s:actionmessage /></div>

But no show any message. When I add a method "validate" in the action class,
it works and, I can see the message in the jsp.

Any idea?

Thanks.

Reply via email to