You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Juanjo Cuadrado <jj...@gmail.com> on 2008/10/14 11:54:14 UTC
[S2] Problem showing errors message with xxx-validation.xml
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.
Re: [S2] Problem showing errors message with xxx-validation.xml
Posted by Juanjo Cuadrado <jj...@gmail.com>.
Néstor, thank for you reply... but:
I have it all like you say (I don't know what do you mean with "You must
have de validation and workflow interceptors configured" I have the struts
file by default, I haven't configured any interceptor. Have I to do it?).
I have put the result "input" but always go to result "success" like if all
fields are OK. :-(
2008/10/14 Néstor Boscán <ne...@gmail.com>
> The way it worked for me was:
>
> 1.- You have to extend ActionSupport because it contains the fieldErrors,
> actionErrors attributes and the validation logic.
> 2.- I use <s:fielderror><s:param>dniParticipante</s:param></s:fielderror>
> 3.- You must have de validation and workflow interceptors configured
> 4.- You must have an "input" result because in case of a validation error
> the workflow interceptor will ALWAYS return the "input" result.
> 5.- If you want javascript validation you must use <s:form ...
> validate="true"/>
>
> Nestor
> On Tue, Oct 14, 2008 at 10:08 AM, Lukasz Lenart <
> lukasz.lenart@googlemail.com> wrote:
>
> > 2008/10/14 Juanjo Cuadrado <jj...@gmail.com>:
> > > No... but this too I have tried it :(
> >
> > Are you extending you package from struts-default?
> >
> >
> > Regards
> > --
> > Lukasz
> > http://www.lenart.org.pl/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
Re: [S2] Problem showing errors message with xxx-validation.xml
Posted by Néstor Boscán <ne...@gmail.com>.
The way it worked for me was:
1.- You have to extend ActionSupport because it contains the fieldErrors,
actionErrors attributes and the validation logic.
2.- I use <s:fielderror><s:param>dniParticipante</s:param></s:fielderror>
3.- You must have de validation and workflow interceptors configured
4.- You must have an "input" result because in case of a validation error
the workflow interceptor will ALWAYS return the "input" result.
5.- If you want javascript validation you must use <s:form ...
validate="true"/>
Nestor
On Tue, Oct 14, 2008 at 10:08 AM, Lukasz Lenart <
lukasz.lenart@googlemail.com> wrote:
> 2008/10/14 Juanjo Cuadrado <jj...@gmail.com>:
> > No... but this too I have tried it :(
>
> Are you extending you package from struts-default?
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: [S2] Problem showing errors message with xxx-validation.xml
Posted by Lukasz Lenart <lu...@googlemail.com>.
2008/10/14 Juanjo Cuadrado <jj...@gmail.com>:
> No... but this too I have tried it :(
Are you extending you package from struts-default?
Regards
--
Lukasz
http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Problem showing errors message with xxx-validation.xml
Posted by Juanjo Cuadrado <jj...@gmail.com>.
No... but this too I have tried it :(
2008/10/14 Lukasz Lenart <lu...@googlemail.com>
> 2008/10/14 Juanjo Cuadrado <jj...@gmail.com>:
> > 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>
>
> Is es.mec.adesi.ctl.actions.solicitudes.TestAction extending ActionSupport?
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: [S2] Problem showing errors message with xxx-validation.xml
Posted by Lukasz Lenart <lu...@googlemail.com>.
2008/10/14 Juanjo Cuadrado <jj...@gmail.com>:
> 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>
Is es.mec.adesi.ctl.actions.solicitudes.TestAction extending ActionSupport?
Regards
--
Lukasz
http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org