You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2009/08/01 14:37:56 UTC

RE: t5: using Messages in a service

Hi,

Passing Messages as a parameter to a service does not work, I always get
[missing key:?], any idea? 

Angelo
 

Robin K. wrote:
> 
> This is because Messages is not a service.
> It can be injected into pages thanks to InjectWorker / InjectionProvider /
> CommonResourcesInjectionProvider which will call the ComponentResources of
> the current component/page.
> That's why, in fact, you can only inject Messages into a page or a
> component.
> 
> 
> One solution to have a handle on your Messages into a service is to call
> your service method from your component/page with Messages as a parameter.
> That way, you will access to messages in the current locale.
> 
> To access Messages for a specific locale, take a look to
> ComponentMessagesSource service.
> 
> 
> 
> -----Message d'origine-----
> De : Angelo Chen [mailto:angelochen960@yahoo.com.hk]
> Envoyé : vendredi 31 juillet 2009 04:04
> À : users@tapestry.apache.org
> Objet : t5: using Messages in a service
> 
> 
> Hi,
> 
> I try use constructor injection to inject the Messages into my service,
> but
> I always get a error that:
> Caused by: java.lang.RuntimeException: No service implements the interface
> org.apache.tapestry5.ioc.Messages.
>         at
> org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:560)
> that looks like Messages can not be used in a service, but why it can be
> injected from a page?
> and how to access messages for localized messages ? Thanks,
> 
> Angelo
> --
> View this message in context:
> http://www.nabble.com/t5%3A-using-Messages-in-a-service-tp24750002p24750002.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 
> 
> Ce message et les pièces jointes sont confidentiels et réservés à l'usage
> exclusif de ses destinataires. Il peut également être protégé par le
> secret professionnel. Si vous recevez ce message par erreur, merci d'en
> avertir immédiatement l'expéditeur et de le détruire. L'intégrité du
> message ne pouvant être assurée sur Internet, la responsabilité du groupe
> Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien
> que les meilleurs efforts soient faits pour maintenir cette transmission
> exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard
> et sa responsabilité ne saurait être recherchée pour tout dommage
> résultant d'un virus transmis.
> 
> This e-mail and the documents attached are confidential and intended
> solely for the addressee; it may also be privileged. If you receive this
> e-mail in error, please notify the sender immediately and destroy it. As
> its integrity cannot be secured on the Internet, the Atos Origin group
> liability cannot be triggered for the message content. Although the sender
> endeavours to maintain a computer virus-free network, the sender does not
> warrant that this transmission is virus-free and will not be liable for
> any damages resulting from any virus transmitted.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/t5%3A-using-Messages-in-a-service-tp24750002p24768729.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org