[Opensource] Struts1.1 and validation
Peter A. Pilgrim
peterp at xenonsoft.demon.co.uk
Mon Nov 17 18:12:55 PST 2003
Eddie Lewis wrote:
> I am trying to incorporate struts 1.1 validation into expresso
>
>
> I have my config file specified as
>
> default = DefaultForm which extends ActionForm
>
> <action path="/Login" type="com.cal.controller.LoginCont" name="default"
> scope="request" validate="false">
> <forward name="promptLogin" path="/jsp/generic_detail_page.jsp"/>
>
> For struts validation -
> i create my own validation bean and need to reference it in my config.xml as
>
> <action path="/Login" type="com.cal.controller.LoginCont"
> name="loginForm" scope="request" validate="true">
> <forward name="promptLogin" path="/jsp/generic_detail_page.jsp"/>
> loginForm = LoginForm which extends ValidationForm
You got the two action mapping with the same name ( path="/Login" and
the class type ). You need to use one or the other.
>
> when i do this - on calling the state (promptLogin) i get a
> classCastException as LoginForm is not of type DefaultForm.
>
This is because the Struts Config reads the first action mapping and
it takes precedence. The first action mapping says you want to use
the "DefaultForm" which is not a subclass of the ValidatorForm.
You should be able to work it with the Struts Validator,
if you delete the first action mapping.
> is there a way around this or is some setting required ??
> any help would be much appreciated.
> If i can get this working, i will document and send to the community
> as the validation is a pretty handy plugin to complement the expresso
> architecture.
>
> Thats all folks.
> Eddie Lewis
>
>
> ____________________________________________
>
>
> *Eddie Lewis */*
> */
> *Senior Analyst Programmer *
>
> elewis at copyright.com.au <mailto:elewis at copyright.com.au>
>
> Copyright Agency Limited
>
> Tel: +61 2 9394 7685
> Fax: +61 2 9394 7601
>
> www.copyright.com.au <http://www.copyright.com.au/>
>
> *Level 19, 157 Liverpool Street
> Sydney NSW 2000*
>
>
>
>
>
>
>
> This electronic mail message and any attachments are confidential. If
> you are not the intended recipient please do not use the information,
> advise us immediately and destroy this message. Opinions and information
> in this message are those of the sender and not necessarily those of
> CAL. Unless expressly permitted by the sender, you may not copy,
> disclose or use the contents in any way.
--
Peter Pilgrim
__ _____ _____ _____
/ //__ // ___// ___/ + Serverside Java
/ /___/ // /__ / /__ + Struts
/ // ___// ___// ___/ + Expresso Committer
__/ // /__ / /__ / /__ + Independent Contractor
/___//____//____//____/ + Intrinsic Motivation
On Line Resume
||
\\===> `` http://www.xenonsoft.demon.co.uk/no-it-striker.html ''
More information about the Opensource
mailing list