Thanks everyone. I guess the preferred approach is to write a service to provide various constants like this.

All my pages extend a very basic Page.java so I can just import the service into that and create accessors as necessary - that should be the most efficient way to do what I want.

Cheers
Mark

On 5 May 2010, at 1:10 pm, Inge Solvoll wrote:

I guess you could also contribute these strings to be accessible by
SymbolSource? This way you can easily inject single values into the
page/component class like this:

@Property
@Inject
@Symbol("streamServerLocation")
private String streamServerLocation;

On Wed, May 5, 2010 at 2:00 PM, Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

On Wed, 05 May 2010 07:27:25 -0300, Mark Allan <mark.al...@ed.ac.uk>
wrote:

Hi All,


Hi!


I've tried a number of variations on the following, but nothing works:
      ${message:comp/env/StreamServerLocation}


As Inge said, the Tapestry philosophy is to implement logic in classes, not
in templates. You can implement what you want this way:

Page or component class:
public String getStreamServerLocation() {
      return (String)((new
InitialContext()).lookup("java:comp/env/StreamServerLocation"))
}

In your template:

${streamServerLocation}

Better yet, follow Inge's advice and put this logic in a server, so it can
be reused all over your application.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br


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




--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


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

Reply via email to