Skip to Content
author's profile photo Former Member
Former Member

Configuration Bean

Hello together,

I want to create a config bean which I access in my JSPs to read, well, configurations and settings. The source of this bean should be a .properties file which can then easily be modified without rebuilding everything.

My attempt lokked like this:

- take the .properties file and load it with an input stream

- wrap the file contents into a Properties object

- put the Properties object into the JSP session context

- read properties with JSP scriptlets

So far so good. Everything works. But the path to the .properties file varies from an application launch within eclipse and a launch from within mobile engine. When launching from eclipse I have a different root directory where the file is searched for than in mobile engine. Any hints where to configure the working directory in eclipse to be the same as in ME itsself?

Best regards,

Tim

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Mar 03, 2005 at 08:22 PM

    Hi Tim,

    you can please the file inside your application and get the path to it with

    Configuration.getInstance().getInstallationDirectory()

    + the subDirs to the file.

    Or - even better - put it into the classpath (in ME into the WEB-INF/classes dir or one of your JARs) and use

    getClass().getResourceAsStream("propfile.properties")

    This should do the job. BUT even when you start the ME from eclipse, the path to ME_HOME should be the same, or?

    Best Regards, alex

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.