You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Maldonado, Daniel CW2 CTARNG" <da...@CT.NGB.ARMY.MIL> on 2004/10/14 19:41:27 UTC

Reading .properties file values

OK, I thought this was the right way to read properties from a properties
file but it is not working.  Can someone give me a simple working sample or
direct me where I can find a simple example on how to read properties from a
.properties file?  Please do not direct me to hispacta.  I already read
through it and could not find an implementation anywhere.

Thank you.

#================ CreateDbConnection.properties ==========
project.name = loginTest
target.dir = target
war.file = ${target.dir}/${project.name}.war
file = build.properties
context.dir = context
deploy.dir = C:/jakarta-tomcat-4.1.29/webapps
#================ CreateDbConnection.java file ===========
public class CreateDbConnection extends BasePage {
   private String dbDriver = getMessage("db.driver");
   private String dbPort = getMessage("db.port");
   private String dbDatabase = getMessage("db.database");
   private String dbHost = getMessage("db.host");


Daniel Maldonado
Programmer Analyst


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


Re: Reading .properties file values

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Looks like you're wanting Ant-like property substitution with ${...} 
references.  Sorry, but the resource bundles don't do that sort of 
thing.  It is Ant itself that does that magic,

The Workbench demo application that ships with Tapestry uses 
.properties message resources.  Be sure you are placing the .properties 
file (and naming the same as your page or component) in WEB-INF/

	Erik


On Oct 14, 2004, at 1:41 PM, Maldonado, Daniel CW2 CTARNG wrote:

> OK, I thought this was the right way to read properties from a 
> properties
> file but it is not working.  Can someone give me a simple working 
> sample or
> direct me where I can find a simple example on how to read properties 
> from a
> .properties file?  Please do not direct me to hispacta.  I already read
> through it and could not find an implementation anywhere.
>
> Thank you.
>
> #================ CreateDbConnection.properties ==========
> project.name = loginTest
> target.dir = target
> war.file = ${target.dir}/${project.name}.war
> file = build.properties
> context.dir = context
> deploy.dir = C:/jakarta-tomcat-4.1.29/webapps
> #================ CreateDbConnection.java file ===========
> public class CreateDbConnection extends BasePage {
>    private String dbDriver = getMessage("db.driver");
>    private String dbPort = getMessage("db.port");
>    private String dbDatabase = getMessage("db.database");
>    private String dbHost = getMessage("db.host");
>
>
> Daniel Maldonado
> Programmer Analyst
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


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