You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Gentry, Michael (Contractor)" <mi...@fanniemae.com> on 2005/12/22 22:28:54 UTC
Abstract superclass for pages with injection in T4?
Since getVisit() and getGlobal() have been deprecated and I need the
visit on every page in my application and the global on some of them, I
decided to try to roll my own solution. I've searched through the
documentation and this list, but still haven't stumbled across the right
magic. What I have is:
AbstractPage (Tapestry)
BasePage (Tapestry)
CommonPage (Mine)
Home/etc (Mine)
In CommonPage.java I have:
public abstract class CommonPage extends BasePage
{
public abstract Application getApplication(); // was getGlobal()
public abstract Session getSession(); // was getVisit()
}
CommonPage.page contains:
...
<inject property="session" type="state" object="session"/>
...
Home extends CommonPage. I also have a hivemodule.xml file. When I
load Home, the session is never injected and getSession returns null.
If I move the <inject...> from CommonPage.page to Home.page, the
injection will occur and I'll get a session. However, I don't want to
have to have an <inject...> in every single .page (seems kind of silly).
Does anyone have suggestions for making this work? I could continue
using getVisit() and getGlobal(), but I really don't want any warnings
(even if they are just deprecation) present in my build. Also, I never
could stumble upon the correct <inject...> syntax for a global object.
Thanks!
/dev/mrg
PS. T4 RC1 with Java 1.4.2.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Abstract superclass for pages with injection in T4?
Posted by Derick Fernando <de...@thelabllc.com>.
Please look at this older post:
http://thread.gmane.org/gmane.comp.java.tapestry.user/27105
Hope that helps.
Ron Piterman wrote:
> ok - it seems you don't use jdk1.5. the .page file does not get inherited.
> The only solution I can see is copy/paste the <inject to all your .page
> defs.
>
> Gentry, Michael (Contractor) wrote:
>
>> Since getVisit() and getGlobal() have been deprecated and I need the
>> visit on every page in my application and the global on some of them, I
>> decided to try to roll my own solution. I've searched through the
>> documentation and this list, but still haven't stumbled across the right
>> magic. What I have is:
>>
>> AbstractPage (Tapestry)
>> BasePage (Tapestry)
>> CommonPage (Mine)
>> Home/etc (Mine)
>>
>> In CommonPage.java I have:
>>
>> public abstract class CommonPage extends BasePage
>> {
>> public abstract Application getApplication(); // was getGlobal()
>> public abstract Session getSession(); // was getVisit()
>> }
>>
>> CommonPage.page contains:
>>
>> ...
>> <inject property="session" type="state" object="session"/>
>> ...
>>
>> Home extends CommonPage. I also have a hivemodule.xml file. When I
>> load Home, the session is never injected and getSession returns null.
>> If I move the <inject...> from CommonPage.page to Home.page, the
>> injection will occur and I'll get a session. However, I don't want to
>> have to have an <inject...> in every single .page (seems kind of silly).
>>
>> Does anyone have suggestions for making this work? I could continue
>> using getVisit() and getGlobal(), but I really don't want any warnings
>> (even if they are just deprecation) present in my build. Also, I never
>> could stumble upon the correct <inject...> syntax for a global object.
>>
>> Thanks!
>>
>> /dev/mrg
>>
>> PS. T4 RC1 with Java 1.4.2.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
> __________ NOD32 1.1275 (20051103) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
--
.........................................
Derick Fernando
Lead Architect
derickf@thelabllc.com
(323) 314-9593
http://www.thelabllc.com
Content is for intended recipient only.
Copyright 2001-2005, The Lab, LLC
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Abstract superclass for pages with injection in T4?
Posted by Ron Piterman <rp...@gmx.net>.
ok - it seems you don't use jdk1.5. the .page file does not get inherited.
The only solution I can see is copy/paste the <inject to all your .page
defs.
Gentry, Michael (Contractor) wrote:
> Since getVisit() and getGlobal() have been deprecated and I need the
> visit on every page in my application and the global on some of them, I
> decided to try to roll my own solution. I've searched through the
> documentation and this list, but still haven't stumbled across the right
> magic. What I have is:
>
> AbstractPage (Tapestry)
> BasePage (Tapestry)
> CommonPage (Mine)
> Home/etc (Mine)
>
> In CommonPage.java I have:
>
> public abstract class CommonPage extends BasePage
> {
> public abstract Application getApplication(); // was getGlobal()
> public abstract Session getSession(); // was getVisit()
> }
>
> CommonPage.page contains:
>
> ...
> <inject property="session" type="state" object="session"/>
> ...
>
> Home extends CommonPage. I also have a hivemodule.xml file. When I
> load Home, the session is never injected and getSession returns null.
> If I move the <inject...> from CommonPage.page to Home.page, the
> injection will occur and I'll get a session. However, I don't want to
> have to have an <inject...> in every single .page (seems kind of silly).
>
> Does anyone have suggestions for making this work? I could continue
> using getVisit() and getGlobal(), but I really don't want any warnings
> (even if they are just deprecation) present in my build. Also, I never
> could stumble upon the correct <inject...> syntax for a global object.
>
> Thanks!
>
> /dev/mrg
>
> PS. T4 RC1 with Java 1.4.2.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Abstract superclass for pages with injection in T4?
Posted by Ron Piterman <rp...@gmx.net>.
if you are using java 1.5, use annotations (just for that injected
property), this will solve your problem.
Cheers,
Ron
Gentry, Michael (Contractor) wrote:
> Since getVisit() and getGlobal() have been deprecated and I need the
> visit on every page in my application and the global on some of them, I
> decided to try to roll my own solution. I've searched through the
> documentation and this list, but still haven't stumbled across the right
> magic. What I have is:
>
> AbstractPage (Tapestry)
> BasePage (Tapestry)
> CommonPage (Mine)
> Home/etc (Mine)
>
> In CommonPage.java I have:
>
> public abstract class CommonPage extends BasePage
> {
> public abstract Application getApplication(); // was getGlobal()
> public abstract Session getSession(); // was getVisit()
> }
>
> CommonPage.page contains:
>
> ...
> <inject property="session" type="state" object="session"/>
> ...
>
> Home extends CommonPage. I also have a hivemodule.xml file. When I
> load Home, the session is never injected and getSession returns null.
> If I move the <inject...> from CommonPage.page to Home.page, the
> injection will occur and I'll get a session. However, I don't want to
> have to have an <inject...> in every single .page (seems kind of silly).
>
> Does anyone have suggestions for making this work? I could continue
> using getVisit() and getGlobal(), but I really don't want any warnings
> (even if they are just deprecation) present in my build. Also, I never
> could stumble upon the correct <inject...> syntax for a global object.
>
> Thanks!
>
> /dev/mrg
>
> PS. T4 RC1 with Java 1.4.2.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org