I think you may be better off using a MessagesSource service.

Check out ValidationMessagesSource for some ideas.
TapestryModule.java (in particular the contribute and build methods got
ValidationMessagesSource):
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java?view=markup

ValidationMessagesSource.java (interface):
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ValidationMessagesSource.java?view=markup

ValidationMessagesSourceImpl.java:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ValidationMessagesSourceImpl.java?view=markup

Peter Beshai

On Sat, Apr 19, 2008 at 7:08 AM, nille hammer
<[EMAIL PROTECTED]> wrote:

>
> Hi Michael,
>
> I have tried your suggestion. In my environment (5.0.11) it does not work.
> Even with explicit id "Messages" provided, the ioc-container throws a
> RuntimeException complaining that Messages is not a defined service. You
> must have done sth. else to make your suggestion work in your environment.
> Although the RuntimeException your suggestion caused, helped me a lot! It
> shows all ids of defined services. Amongst them is ComponentSource, which
> serves my needs. So YOU helped me man, maybe not in the intended way, but
> you did ;-)
>
> I myself (as well as obviously the ioc-container) have problems
> considering Messages a service. To me it only gets a meaning as part of a
> particular page/component. Thinking about that I was looking for methods to
> get a hand on that part. As it turned out in Tapestry the right term to look
> for is "resource". And this is how i have rewritten my build method:
>
> public static KursConfirmationSender
> builConfirmationMailSender(ComponentSource cs ) {
>  return new
> ConfirmationMaiilSenderImpl(cs.getPage("bookings/Summary").getComponentResources().getMessages());
> }
>
> "bookings/Summary" is the logical name of the page that holds the messages
> needed for assembly of the email. I am thinking about implementing a "page"
> ConfirmationMail that serves the only purpose to hold the messages. May be I
> will do that later.
>
> So thanks to Thiago, Michael and Sven for your efforts,
> nillehammer
>
>
>
> ----- original Nachricht --------
>
> Betreff: Re: [T5] Sending Email from Tapestry
> Gesendet: Sa, 19. Apr 2008
> Von: Michael Gerzabek<[EMAIL PROTECTED]>
>
> > nille,
> >
> > maybe you wanna try adding the InjectService annotation. This at least
> > works for my services.
> >
> > public static ConfirmationMailSender
> > buildConfirmationMailSender(
> >   @InjectService("Messages")
> >   Messages messages) {
> >   return new ConfirmationMailSender(messages);
> > }
> >
> > good morning,
> > Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to