You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by manub <e....@reply.it> on 2009/05/14 12:24:46 UTC

xml validation

Hi,

I've got two problems with XML validation :(

- I'm not able to perform an equality check on two parameters. I've got
password and confirmPassword which I try to validate using something like:

       	<validator type="expression">
				confirmPassword.equals(password)
				<message>...</message>
		</validator>

What am I getting wrong? 

- Even if I'm putting input that should be validated, I'm never going to the
execute method of the action. It seems that validation always fails.


DEBUG [http-8080-1] (CommonsLogger.java:57) - Bypassing
//EseguiRegistrazione
DEBUG [http-8080-1] (CommonsLogger.java:57) - Validating
//EseguiRegistrazione with method execute.
DEBUG [http-8080-1] (CommonsLogger.java:57) - Forwarding to location
/pages/account/registrazione.jsp

(EseguiRegistrazione is the action I forward my submit to, the one that is
validated, and the location is the one associated to input result)

Using Struts 2.1.6.

Thanks.
-- 
View this message in context: http://www.nabble.com/xml-validation-tp23537908p23537908.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: xml validation

Posted by Martin Gainty <mg...@hotmail.com>.
        <!-- Field Validator Syntax -->
        <field name="myField">
            <field-validator type="fieldexpression">
                <param name="expression"><![CDATA[#password = #confirmPassword]]></param>
                <message>la parola d'accesso dovrebbe essere uguale al confirmPassword
</message>
            </field-validator>
        </field>
for field-validation

we would need to see the interceptor stack you're using, and the action configuration as earlier suggested
for a complete diagnosis

Martin Gainty 
______________________________________________ 
Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Fri, 15 May 2009 06:03:40 -0500
> Subject: Re: xml validation
> From: stanlick@gmail.com
> To: user@struts.apache.org
> 
> I use this successfully.
> 
> <field name="credential.password">
>         <field-validator type="expression">
>             <param name="expression">
> 
> credential.passwordRepeat.toUpperCase().equals(credential.password.toUpperCase())
>             </param>
>             <message key="passwordsNotMatching" />
>         </field-validator>
>     </field>
> 
> On Thu, May 14, 2009 at 2:11 PM, Dave Newton <ne...@yahoo.com> wrote:
> 
> > manub wrote:
> >
> >> - I'm not able to perform an equality check on two parameters. I've got
> >> password and confirmPassword which I try to validate using something like:
> >>
> >>        <validator type="expression">
> >>                                confirmPassword.equals(password)
> >>                                <message>...</message>
> >>                </validator>
> >>
> >> What am I getting wrong?
> >> - Even if I'm putting input that should be validated, I'm never going to
> >> the
> >> execute method of the action. It seems that validation always fails.
> >>
> >>
> >> DEBUG [http-8080-1] (CommonsLogger.java:57) - Bypassing
> >> //EseguiRegistrazione
> >> DEBUG [http-8080-1] (CommonsLogger.java:57) - Validating
> >> //EseguiRegistrazione with method execute.
> >> DEBUG [http-8080-1] (CommonsLogger.java:57) - Forwarding to location
> >> /pages/account/registrazione.jsp
> >>
> >> (EseguiRegistrazione is the action I forward my submit to, the one that is
> >> validated, and the location is the one associated to input result)
> >>
> >> Using Struts 2.1.6.
> >>
> >
> > Include the complete field validation configuration, the interceptor stack
> > you're using, and the action configuration.
> >
> > Dave
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >

_________________________________________________________________
Hotmail® goes with you. 
http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009

Re: xml validation

Posted by st...@gmail.com.
I use this successfully.

<field name="credential.password">
        <field-validator type="expression">
            <param name="expression">

credential.passwordRepeat.toUpperCase().equals(credential.password.toUpperCase())
            </param>
            <message key="passwordsNotMatching" />
        </field-validator>
    </field>

On Thu, May 14, 2009 at 2:11 PM, Dave Newton <ne...@yahoo.com> wrote:

> manub wrote:
>
>> - I'm not able to perform an equality check on two parameters. I've got
>> password and confirmPassword which I try to validate using something like:
>>
>>        <validator type="expression">
>>                                confirmPassword.equals(password)
>>                                <message>...</message>
>>                </validator>
>>
>> What am I getting wrong?
>> - Even if I'm putting input that should be validated, I'm never going to
>> the
>> execute method of the action. It seems that validation always fails.
>>
>>
>> DEBUG [http-8080-1] (CommonsLogger.java:57) - Bypassing
>> //EseguiRegistrazione
>> DEBUG [http-8080-1] (CommonsLogger.java:57) - Validating
>> //EseguiRegistrazione with method execute.
>> DEBUG [http-8080-1] (CommonsLogger.java:57) - Forwarding to location
>> /pages/account/registrazione.jsp
>>
>> (EseguiRegistrazione is the action I forward my submit to, the one that is
>> validated, and the location is the one associated to input result)
>>
>> Using Struts 2.1.6.
>>
>
> Include the complete field validation configuration, the interceptor stack
> you're using, and the action configuration.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: xml validation

Posted by manub <e....@reply.it>.


newton.dave wrote:
> 
> 
> Include the complete field validation configuration, the interceptor 
> stack you're using, and the action configuration.
> 
> Dave
> 
> 

Hi Dave,

I solved it. Thanks. Now I've got another question, still about validation.
I'm trying to write a custom field validator that validates a code. For
validating that code, I need other params that are in the form I submitted.
I'm extending FieldValidatorSupport, but it seems I cannot pass other params
to that validator.

Example: a form with a, b, and c textfield. for validating c, I need a and b
values. It is possible to write a field validator for c and specifying in
the Action validator to pass that params?

I hope I have been clear.

Thank you.

-- 
View this message in context: http://www.nabble.com/xml-validation-tp23537908p23556953.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: xml validation

Posted by Dave Newton <ne...@yahoo.com>.
manub wrote:
> - I'm not able to perform an equality check on two parameters. I've got
> password and confirmPassword which I try to validate using something like:
> 
>        	<validator type="expression">
> 				confirmPassword.equals(password)
> 				<message>...</message>
> 		</validator>
> 
> What am I getting wrong? 
> 
> - Even if I'm putting input that should be validated, I'm never going to the
> execute method of the action. It seems that validation always fails.
> 
> 
> DEBUG [http-8080-1] (CommonsLogger.java:57) - Bypassing
> //EseguiRegistrazione
> DEBUG [http-8080-1] (CommonsLogger.java:57) - Validating
> //EseguiRegistrazione with method execute.
> DEBUG [http-8080-1] (CommonsLogger.java:57) - Forwarding to location
> /pages/account/registrazione.jsp
> 
> (EseguiRegistrazione is the action I forward my submit to, the one that is
> validated, and the location is the one associated to input result)
> 
> Using Struts 2.1.6.

Include the complete field validation configuration, the interceptor 
stack you're using, and the action configuration.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org