Hi Mike,

I inject my pages with constants as well (I too have a constant page
class). I however, do a static import and annotation which works
rather nicely with JDK 1.5. I haven't tried yet injecting page via
XML, but seems to me that you need to return an instance of the actual
page not the value of the constant. Your constants are page name
strings, correct? So I'd think if you do object="ognl:..." maybe a
actual page instance would work? But that would be cumbersome I
guess... Did you try value="..." ?

Anyway, you can look at my code (source code is linked to JavaDoc:
http://www.opendating.org/dev/javadoc/) which works nice for my app.
Few pages I recall off the top of my head do injections:
RegistrationPage, PostalCodeHelpPage1, and RegistrationCaptchaPage.

You may have solved your problem already since this hasn't been
answered for a while, but good luck to you anyway.

Adam

On 4/10/06, Mike Snare <[EMAIL PROTECTED]> wrote:
> I have a central repository (PageConstants.java) for page names.  I
> need to inject a page into another.  The problem is that It doesn't
> seem to work to inject the actual name of the page.
>
> Let's say I have a page named Foo.  I would therefore have the
> following in PageConstants.java:
>   public static final String FOO_PAGE = "Foo";
>
> Then, in my page file i'd like to use the FOO_PAGE member for the injection:
>
> <inject property="fooPage" type="page"
> object="@[EMAIL PROTECTED]"/>
>
> But that doesn't work.  I get the following error:
>
> Exception invoking listener method showInfo of component Bar: Page
> '@[EMAIL PROTECTED] not found in application
> namespace.
>
> So i try to add an ognl prefix:
>
> <inject property="viewPage" type="page"
> object="ognl:@[EMAIL PROTECTED]"/>
>
> But that doesn't work either:
>
> Exception invoking listener method showInfo of component Bar: Library
> 'ognl' not found in application namespace.
>
> I'm using Tap4, java1.4 (1.5 is not an option, so no annotation
> suggestions, please).
>
> Any ideas what I'm doing wrong or how to fix it?
>
> I can just inject the name and get the page myself, but I'd rather not
> if I don't have to.
>
> -Mike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to