[EMAIL PROTECTED] wrote:
Thanks. I was hoping to avoid this in every page file, but I think I will go 
this route since it seems to be the easiest.

-Greg

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


Add the following to your  .page file :

<inject name="adminVisit" type="state"
object="adminVisit"/>


Then add the following in your .jave file :
Public abstract AdminVisit getAdminVisit();

Please checkout the doc :

http://tapestry.apache.org/tapestry4/UsersGuide/state.html#state.aso

Shing

--- [EMAIL PROTECTED] wrote:

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]




Home page :
  http://uk.geocities.com/matmsh/index.html


                
___________________________________________________________ Yahoo! Messenger - with free PC-PC calling and photo sharing. http://uk.messenger.yahoo.com

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


Greg,

You can do what you described before, but pull your visit object in your SomePage.java classes where you need it. As Ron pointed out, ASM uses other service where WebRequest is required. When you're using it, it's still null.

-Dennis


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

Reply via email to