You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Melvin <mi...@intelliware.ca> on 2006/01/13 16:57:46 UTC

Pulling properties for Table via annotations

Hey all,
 
Just monkeying around here, trying to get the column definition for a table working properly, and I seem to not quite be getting it:
 
 
@Component (id = "personTable",
                type = "contrib:Table",
                bindings = {"source=person",
                            "columns=literal:Name:name," +
                            "Date of Birth:dateOfBirth," +
                            "Gender:gender,"})
 
The above works fine with the literal: tag.  However I would prefer to pull the names out of the .properties file rather than hard-coding the strings in the Java classes.
 
The properties file currently looks like:
 
name-label=Name
date-of-birth-label=Date of Birth
gender-label=Gender
 
 
 
I have tried using message: rather than literal: , but that does not seem to actually pull the values from the properties files.  I end up getting NAME, DATEOFBIRTH and GENDER instead.
 
Any suggestions?
 
-mike
 
 
 
 
 
 

Re: Pulling properties for Table via annotations

Posted by Robert Zeigler <ro...@scazdl.org>.
contrib:table tries to use a property file by default.
Make your column id match your message id.

Your table definition could be as simple as:

@Component (id="personTable",type="contrib:Table",
            bindings={"source=person","columns=name,dateOfBirth,gender"}
           )

And your .properties file:

name=Name
gender=Gender
dateOfBirth=Date of Birth

Robert

Michael Melvin wrote:
> Hey all,
>  
> Just monkeying around here, trying to get the column definition for a table working properly, and I seem to not quite be getting it:
>  
>  
> @Component (id = "personTable",
>                 type = "contrib:Table",
>                 bindings = {"source=person",
>                             "columns=literal:Name:name," +
>                             "Date of Birth:dateOfBirth," +
>                             "Gender:gender,"})
>  
> The above works fine with the literal: tag.  However I would prefer to pull the names out of the .properties file rather than hard-coding the strings in the Java classes.
>  
> The properties file currently looks like:
>  
> name-label=Name
> date-of-birth-label=Date of Birth
> gender-label=Gender
>  
>  
>  
> I have tried using message: rather than literal: , but that does not seem to actually pull the values from the properties files.  I end up getting NAME, DATEOFBIRTH and GENDER instead.
>  
> Any suggestions?
>  
> -mike
>  
>  
>  
>  
>  
>  
> 


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