Hey!

I'll also want to read properties on server side from a .properties
file. The .properties file is in some package. I want to read
attributes from it from the .java file that resides in the same
package as the .properties file. If I try to load it as follows, file
cannot be found:

Properties props = new Properties();
props.load(new FileInputStream(settingsFileName)); // settingsFileName
stores exact filename

I also tried to get the InputStream to the .properties file with the
following procedure:
this.getClass().getClassLoader().getResourceAsStream
(settingsFileName); // settingsFileName stores exact filename

Thanks and regards!

On Jan 29, 12:32 am, Fitch <[email protected]> wrote:
> ok.. thanks!
>
> I finally managed to get to the .propertiesfile from the server
> side... but I´ll try this and i´ll post my results.
>
> thanks
>
> On 28 ene, 05:02, Litty Preeth <[email protected]> wrote:
>
> > Well you can get that by:
>
> > getThreadLocalRequest().getSession().getServletContext().getInitParameter("db_driver");
>
> > You can do this only from your RPC service implementation class
>
> > - Litty
>
> > On Tue, Jan 27, 2009 at 10:40 PM, Fitch <[email protected]> wrote:
>
> > > Thank you..
> > > and then how I access this web.xml from my .java file in the server
> > > package??
>
> > > thanks
>
> > > On 27 ene, 05:37, Litty Preeth <[email protected]> wrote:
> > > > Are you sure the application is able to find thepropertiesfile? Did u
> > > try
> > > > debugging and find out this? Also the best way to configure ur 
> > > > connection
> > > > parameters is to put it in your web.xml context-param like:
> > > > <web-app>
> > > > .......
> > > > .......
> > > > <context-param>
> > > >     <param-name>db_driver</param-name>
> > > >     <param-value>oracle.jdbc.driver.OracleDriver</param-value>
> > > > </context-param>
> > > > <context-param>
> > > >     <param-name>db_server</param-name>
> > > >     <param-value>192.168.31.41</param-value>
> > > > </context-param>
> > > > .....
> > > > .....
> > > > </web-app>
>
> > > > - litty preeth
>
> > > > On Tue, Jan 27, 2009 at 6:39 AM, Fitch <[email protected]> wrote:
>
> > > > > Hi, i´m devloping a GWT web application and i´m having problems
> > > > > deploying it.
> > > > > My application does interact with a database, so i have got a client
> > > > > package and a server package. The operations with the database are in
> > > > > the server package. I would like to specify database parameters (url,
> > > > > username and pass) in a .propertiesfile. This way, I can change the
> > > > > url, username or password without compiling again.
>
> > > > > How can I do this? I tried having a "file.properties" file at WEB-INF/
> > > > > classes/ and then access it from my server package with this:
>
> > > > > this.getClass().getClassLoader().getResourceAsStream
> > > > > ("procedimientos.properties");
>
> > > > > but this does not work, when i change the data at file.properties, the
> > > > > application continues connecting to the same database. Even if i
> > > > > delete the file from web-inf/classes at tomcat/webapps folder, it does
> > > > > work.
>
> > > > > Can anyone help me, please??
>
> > > > > Thank you very much- Ocultar texto de la cita -
>
> > > > - Mostrar texto de la cita -

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to