I understood, that the tapestry 4.0 framework can handle more then 2
statefull Objects.
I started my implementation 1,5 years ago, so there were a Global and a
Visit Object (Tapestry 3.0).
Now i want to keep my Visit and Global objects. I still want to use
injection instead of the deprecated "IPage.getGlobal" and
"IPage.getVisit" methods (cause they could be removed in newer Tapestry
versions).
I dont know, why i cant use Annotations to inject the objects.
When i add
<inject property="globalObject" type="state" object="globalObject"/>
and delete this line from app.application:
<property name="org.apache.tapestry.global-class"
value="de.atron.b2xsale.web.Global"/>
in ".page" it works nice.
My question is:
Why i cant inject the GlobalObject with this:
@InjectState("globalObject")
public abstract Global getGlobalObject();
I dont know... I quess it should work.
Raul Raja Martinez wrote:
I think there is a problem of concept here , you can inject as many
global object as you want, there is no such thing as a global object.
for example:
> <contribution configuration-id="tapestry.state.ApplicationObjects">
> <state-object name="globalObject" scope="application">
> <create-instance class="my.package.User"/>
> </state-object>
> </contribution>
but you still have to define your own User class
public class User {
....
}
> <contribution configuration-id="tapestry.state.ApplicationObjects">
> <state-object name="globalObject" scope="application">
> <create-instance class="my.package.User"/>
> </state-object>
> <state-object name="mySessionDomethingElse" scope="session">
> <create-instance class="my.package.SomethingElse"/>
> </state-object>
> </contribution>
public class SomethingElse {
....
}
Notice how I keep adding objects as I need them, and I can change
their scope to be application (global) or session (httpSession)
I hope this helps, I'm not quite sure if you're confused on how to use
the configuration point tapestry.state.ApplicationObjects or you have
some other problem injecting state objects.
best regards.
Raul Raja.
Rudolf Baloun wrote:
Hi,
i try to inject the Global object into my Page, but my injected
Object is null.
I added this in my hivemodule.xml:
<contribution configuration-id="tapestry.state.ApplicationObjects">
<state-object name="globalObject" scope="application">
<create-instance class="my.package.Global"/>
</state-object>
</contribution>
and this in my Page:
@InjectState("globalObject")
public abstract Global getGlobalObject();
I guess, this should work. When i use "getGlobalObject()" in my Page,
the Object is null.
Whats wrong?!
(I use Tapestry 4.0 final. With the method "getGlobal()" from the
Page it works, but the method is deprecated, so i want to
inject the Global object)
Best regards
Rudolf B.
---------------------------------------------------------------------
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]