Unfortunately I can't use JDK 1.5. Which is what a lot of documentation seems 
to cover, everyone loves annotations but I get left out!

Thanks,
Greg

-----Original Message-----
From: Wes Bramhall [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 14, 2006 2:04 PM
To: Tapestry users
Subject: RE: Proper way to get ApplicationStateManager?


Are you able to use Java 1.5? The way we do it is by injection using
annotations.

@InjectState("adminVisit")
Public abstract AdminVisit getAdminVisit();

We inject the visit on our base page and have a convenience method on
our base component to get it from the page. ASOs can also be accessed in
other Hivemind services by injecting the ApplicationStateManager into
the service and asking the ASM for the ASO by name.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 14, 2006 12:47 PM
To: users@tapestry.apache.org
Subject: Proper way to get ApplicationStateManager?

I need help with ASO's.

In my Application Servlet..

        public class PCTAdminApplicationServlet extends
ApplicationServlet ..

I have a static variable "asm". I have my init() method with the
following :

public void init() throws ServletException
  {
    super.init();
    .......
    Registry myRegistry = RegistryBuilder.constructDefaultRegistry();
    PCTAdminApplicationServlet.asm =
(ApplicationStateManager)myRegistry.getService(ApplicationStateManager.c
lass);
    ...
  }


Is this the proper way to do things? I'm getting a NullPointerException
when trying something like

AdminVisit aVisit = (AdminVisit)
PCTAdminApplicationServlet.asm.get("adminVisit");



Thanks,
Greg

---------------------------------------------------------------------
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]


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

Reply via email to