You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Gundersen, Richard" <Ri...@london-scottish.com> on 2008/07/30 18:01:22 UTC

Wierd Validation

Hi

When validation succeeds on my form, I still get returned to the input
page. My execute() method does not seem to be getting called even when
validation is OK. 

This is my Action  (no @Validation annotation after I read that was
deprecated)

=======================================================
    @Validations(visitorFields = {
        @VisitorFieldValidator(message = "Default message",
        fieldName = "surname",
        appendPrefix = false)
    })
    public String execute() {
	...


    @RequiredStringValidator(message="Validation error",
key="validate.surname")
    public String getSurname() {
        return surname;
    }
	...
=======================================================



This is my struts.xml snippet, with the correct result attributes 

        <action name="login" method="execute" class="loginAction">
            <result name="success" type="tiles">home</result>
            <result name="input" type="tiles">welcome</result>
        </action>   

In the logs, when I enter an empty surname, I see "surname is invalid"
when I expect. The same message is not in the logs when I enter a valid
value, so I would expect it to then drop into my 'execute' method. But
it doesn't, it just returns to the 'input' page...

Any ideas?

Regards

Richard Gundersen


As a responsible corporate citizen, London Scottish Bank plc asks you to consider the environment before printing this email.

*** Disclaimer *** 

This electronic communication is confidential and for the exclusive use of the addressee. It may contain private and confidential information. The information, attachments and opinions contained in this E-mail are those of its author only and do not necessarily represent those of London Scottish Bank PLC or any other members of the London Scottish Group. 

If you are not the intended addressee, you are prohibited from any disclosure, distribution or further copying or use of this communication or the information in it or taking any action in reliance on it. If you have received this communication in error please notify the Information Security Manager at ISM@London-Scottish.com as soon as possible and delete the message from all places in your computer where it is stored. 

We utilise virus scanning software but we cannot guarantee the security of electronic communications and you are advised to check any attachments for viruses. We do not accept liability for any loss resulting from any corruption or alteration of data or importation of any virus as a result of receiving this electronic communication. 

Replies to this E-mail may be monitored for operational or business reasons. London Scottish Bank PLC is regulated by the Financial Services Authority.


London Scottish Bank plc, Registered Office: 201 Deansgate, Manchester M3 3NW Registered Number 973008 England.

Subsidiary Companies:-

London Scottish Finance Limited, Registered Office: 201 Deansgate, Manchester M3 3NW Registered Number 233259 England.

London Scottish Broking Limited, Registered Office: 201 Deansgate, Manchester M3 3NW Registered Number 230110 England.

London Scottish Invoice Finance Limited, Registered Office: 201 Deansgate, Manchester M3 3NW Registered Number 2643766 England.

Robinson Way & Company Limited, Registered Office: 201 Deansgate, Manchester M3 3NW Registered Number 885896 England.

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.

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


Re: Wierd Validation

Posted by Laurie Harper <la...@holoweb.net>.
Gundersen, Richard wrote:
> Hi
> 
> When validation succeeds on my form, I still get returned to the input
> page. My execute() method does not seem to be getting called even when
> validation is OK. 
> 
> This is my Action  (no @Validation annotation after I read that was
> deprecated)
> 
> =======================================================
>     @Validations(visitorFields = {
>         @VisitorFieldValidator(message = "Default message",
>         fieldName = "surname",
>         appendPrefix = false)
>     })
>     public String execute() {
> 	...
> 
> 
>     @RequiredStringValidator(message="Validation error",
> key="validate.surname")
>     public String getSurname() {
>         return surname;
>     }
> 	...
> =======================================================

Do you have a setSurname(String) method? Without it, Struts can't pass 
the input data into your action.

> This is my struts.xml snippet, with the correct result attributes 
> 
>         <action name="login" method="execute" class="loginAction">
>             <result name="success" type="tiles">home</result>
>             <result name="input" type="tiles">welcome</result>
>         </action>   
> 
> In the logs, when I enter an empty surname, I see "surname is invalid"
> when I expect. The same message is not in the logs when I enter a valid
> value, so I would expect it to then drop into my 'execute' method. But
> it doesn't, it just returns to the 'input' page...
> 
> Any ideas?

If you do have the setter in your action and you're getting this, do you 
have any action errors/messages showing up when you get returned to the 
input page?

L.



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