tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ALEXANDROS KOTSIRAS" <ALEXANDRO...@prodigy.net>
Subject Re: using beans to load properties file
Date Mon, 27 May 2002 22:51:28 GMT
Why don't you use ResourceBundle ?
You just place your foo.properties file in any directory that is included in
your classpath.
I have it in WEB-INF/classes.
Then Java will find it without specifying it's exact location.

Alex

----- Original Message -----
From: Jason Novotny <novotny@nlanr.net>
To: <tomcat-user@jakarta.apache.org>
Cc: <rbosch@actv.com>
Sent: Friday, May 26, 2000 5:41 PM
Subject: Re: using beans to load properties file


>
>     Thanks Rick,
>
>     I have my web application packaged pretty nicely using the ANT
build.xml
> stuff, and I want to allow developers to simply deploy my package for
their
> particular site, changing only the values in "foo.properties". It seems
like a
> pain in the %$# to have to ask them to modify tomcat.sh (or tomcat.bat on
> Windows) accordingly :-( In some sense, it's easier to just say "modify
line 32
> of Config.java to reflect the location of foo.properties" and issue
"build".
>     I recall seeing this sort of discussion earlier in the mailing list,
and
> I'm surprised at how painful this task is.
>
>     Jason
>
>
> Rick Bosch wrote:
>
> > pass the path in the startup script in the startup script ( ie java
> > -Dpropdir=here/are/my/properties org.start.Tomcat ).  in a j2ee
compliant
> > you can pass stuff in server.xml and then get it using jndi , but not
> > tomcat.
> >
> > rick
> >
> > ----------
> > >From: Jason Novotny <novotny@nlanr.net>
> > >To: tomcat-user@jakarta.apache.org
> > >Subject: using beans to load properties file
> > >Date: Fri, May 26, 2000, 5:13 PM
> > >
> >
> > >
> > >     I'm trying to stay away from servlets and just use beans and very
> > > simple JSP's. I have a bunch of beans that all do different things and
> > > make use of a "foo.properties" file for some user configurable
settings.
> > > I have a ConfigBean that simply loads the properties file and has
> > > methods to let the other beans know what the values specified in
> > > "foo.properties" are. However, the ConfigBean has to know exactly
where
> > > the "foo.properties" file is located. I would like some way to specify
> > > this (probably in a web.xml or something) and have that accessible to
> > > the ConfigBean.... and I really don't want to have to write any JSP
like
> > > "getServletContext.getInitParameter("foo.properties")"- I'd like that
in
> > > the Bean somehow.
> > >     Any ideas?
> > >
> > >     Thanks, Jason
> > >
> > >
> > > --
> > > Jason Novotny              novotny@nlanr.net
> > > Home: (510) 839-6026       Work: (650) 604-4628
> > > NLANR Applications Support http://dast.nlanr.net
> > >
> > >
> > >
> > >
> >
> --------------------------------------------------------------------------
> > > To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commmands, email: tomcat-user-help@jakarta.apache.org
> >
>
> --------------------------------------------------------------------------
> > To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commmands, email: tomcat-user-help@jakarta.apache.org
>
> --
> Jason Novotny              novotny@nlanr.net
> Home: (510) 839-6026       Work: (650) 604-4628
> NLANR Applications Support http://dast.nlanr.net
>
>
>
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>


Mime
View raw message