You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Earnshaw, Wayne" <wa...@fanniemae.com> on 2006/01/27 21:54:50 UTC

ValidationDelegate null when not using Annotations

Hi folks,

I've been working through the Enjoying Web Development with Tapestry
book (and applying it successfully to our current project - it's a good
tutorial style book, probably not a reference book though :). 

Anyhow, in chapter 3 for Validating Inputs it all works up to page 65.
On Page 66 we switch to using the @Bean annotation  (which I can't use
in JDK1.4.2, so I stick with the following from Home.page)...

    <bean name="delegate"
class="org.apache.tapestry.valid.ValidationDelegate"/>
 
In Home.java I have

    public abstract ValidationDelegate getDelegate();

    public IPage onSubmit() {
	
        ValidationDelegate delegate = getDelegate();
        // here delegate is null
        // one easy solution is to instead use 
        // ValidationDelegate delegate = (ValidationDelegate)
getBeans().getBean("delegate");
    }

The problem is that the delegate returned by the abstract method is
null... 

Do I need to inject this bean somehow?

cheers,

Wayne Earnshaw

The electronic mail message you have received and any files transmitted
with it are confidential and solely for the intended addressee(s)'s
attention. Do not divulge, copy, forward, or use the contents,
attachments, or information without permission of Fannie Mae.
Information contained in this message is provided solely for the purpose
stated in the message or its attachment(s) and must not be disclosed to
any third party or used for any other purpose without consent of Fannie
Mae. If you have received this message and/or any files transmitted with
it in error, please delete them from your system, destroy any hard
copies of them, and contact the sender.     




Re: ValidationDelegate null when not using Annotations

Posted by Howard Lewis Ship <hl...@gmail.com>.
You must add property="delegate" to the <bean> element to have it
injected as a page property.

On 1/27/06, Earnshaw, Wayne <wa...@fanniemae.com> wrote:
> Hi folks,
>
> I've been working through the Enjoying Web Development with Tapestry
> book (and applying it successfully to our current project - it's a good
> tutorial style book, probably not a reference book though :).
>
> Anyhow, in chapter 3 for Validating Inputs it all works up to page 65.
> On Page 66 we switch to using the @Bean annotation  (which I can't use
> in JDK1.4.2, so I stick with the following from Home.page)...
>
>     <bean name="delegate"
> class="org.apache.tapestry.valid.ValidationDelegate"/>
>
> In Home.java I have
>
>     public abstract ValidationDelegate getDelegate();
>
>     public IPage onSubmit() {
>
>         ValidationDelegate delegate = getDelegate();
>         // here delegate is null
>         // one easy solution is to instead use
>         // ValidationDelegate delegate = (ValidationDelegate)
> getBeans().getBean("delegate");
>     }
>
> The problem is that the delegate returned by the abstract method is
> null...
>
> Do I need to inject this bean somehow?
>
> cheers,
>
> Wayne Earnshaw
>
> The electronic mail message you have received and any files transmitted
> with it are confidential and solely for the intended addressee(s)'s
> attention. Do not divulge, copy, forward, or use the contents,
> attachments, or information without permission of Fannie Mae.
> Information contained in this message is provided solely for the purpose
> stated in the message or its attachment(s) and must not be disclosed to
> any third party or used for any other purpose without consent of Fannie
> Mae. If you have received this message and/or any files transmitted with
> it in error, please delete them from your system, destroy any hard
> copies of them, and contact the sender.
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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