At a glance, you just want to call createPageLink on a Page.

So you could inject the PagePool to get the page and go from there.
That's an internal service though ... can't see an obvious way to
do this without "more than a glance". ;-)

Cheers,
Nick.


Angelo Chen wrote:
hi davor,

correction, the problem is ComponentResources used in the constructor, it
has this error:

Exception constructing service 'MyServices': Error invoking constructor
org.bfe.myapp.t5.MyServicesImp(ComponentResources) (at
MyServicesImp.java:36) (for service 'MyServices'): No service implements the
interface org.apache.tapestry.ComponentResources.

seems ComponentResources can be used in this situation? Thanks.

A.C.


Angelo Chen wrote:
Hi,

Thanks, now when there is only one parameter in the constructor, it works:

 public MyServicesImp(ApplicationGlobals globals) {
        this.globals = globals;
    }

but if I have this:

 public MyServicesImp(ApplicationGlobals globals, ComponentResources
resources) {
        this.globals = globals;
        this.resources = resources;
    }

it won't work, any hint?
Thanks,
A.C.


Davor Hrg wrote:
service do not get enhanced like pages do,

services get dependacies through constructor...

http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html

Davor Hrg

On 10/26/07, Angelo Chen <[EMAIL PROTECTED]> wrote:

Hi,

I injected ComponentResources in a service, but it's null, why?

public class MyServicesImp implements MyServices {

    @Inject
    private ComponentResources resources;

    public String createExternalPageLink(String pageName, Object
context)
{
        return getDomainName() + resources.createPageLink(pageName,
true,
context);
    }
}
--
View this message in context:
http://www.nabble.com/T5%3A-inject-ComponentResources-in-a-service-tf4695974.html#a13423186
Sent from the Tapestry - User mailing list archive at Nabble.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]

Reply via email to