Properties file for a servlet at netbeans

I want to make a servlet to use a properties file. The file name is passed as a initialization parameter. I�m developing with netbeans, where should I put this properties file?
And if I want to deploy this to an independent tomcat server?
Thanks in advance,

It's an arbitrary decision by you where you want to put it. If it contains sensitive data, you should consider putting it outside the web root. (Note that if you do that, JAR/WAR/EAR/ZIP, etc. your application, the properties file won't be implicitly included.)
This is where the suggestion for JNDI could be useful, because as far as the app is concerned, it doesn't matter where the properties file is physically located.

Similar Messages

  • Reading a properties file in a servlet and passing its contents to a JSP pa

    Hi all,
    I'm totally new to Servlet pgmg n JSP. Please can ne1 tell how to read a simple properties file (in a servlet) and pass its contents to a JSP page.Actually the reason is to fill a combo box in a JSP page with the contents of a properties file.If calling a servlet for the same is d best way to do that, plz can ne1 tell me :
    1> whether to override the doPost method in the servlet in which to read d file using FileInputStream
    2> Putting the contents in an array and then how to pass this array to the JSP page.
    Thanks,
    deepthy.

    I'm using a properties file to let my web application know what the name of the database is. I'm using an abstract class GeneralDao which will be extended by all the DAO's (Data Access Objects or java classes containing SQL statements).
    Here's the code :
    protected Connection getDatabaseConnection()
              throws Melding
         Connection dbconn = null;     
         ResourceBundle resBundle;
         try
         Class.forName("com.mysql.jdbc.Driver").newInstance();
         resBundle = ResourceBundle.getBundle("gcoConfig");
         String dbConnectie = resBundle.getString("databaseconnection");
         gcoLogger.debug("lezen databaseconnection in resourceBundle " );
         dbconn = DriverManager.getConnection(dbConnectie);
         } catch (InstantiationException exc)The ResourceBundle is used to read the properties file, named gcoConfig.properties.
    With the getString() command I read the content of the string named databaseconnection.
    The gcoConfig.properties file is placed inside the folder C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\gco\WEB-INF\classes
    The GeneralDao is placed in the folder C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\gco\WEB-INF\classes\org\gertcuppens\cluifDao.
    So this class is placed some folder below the WEB-INF\classes folder of gcoConfig.properties.
    And the content of the properties file is just one line :
    databaseconnection=jdbc:mysql://localhost/cluif
    If you want to let the JSP know what's inside the properties file, wrap the content in a Javabean, put it in the request or even the session and pass the control to the JSP.

  • Where can i find .properties file for jco connection?

    For jco connection to SAP, we need .properties file. Is this file already contained in Exchange Profile or somewhere??
    If yes, where can i find .properties file for jco connection or what is the path to this file?
    OR, do we have to create manually??
    Any help is appreciated.
    Thanks.
    Karma

    Hi Karma,
    Please take a look at these..
    Where to set up the JCO connection?
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/42e13d82fcfb34e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_webas620/helpdata/en/bc/42e13d82fcfb34e10000000a114084/content.htm
    cheers,
    Prashanth

  • [svn:fx-trunk] 8056: More updated project properties files for the sparkTest project.

    Revision: 8056
    Author:   [email protected]
    Date:     2009-06-22 12:13:58 -0700 (Mon, 22 Jun 2009)
    Log Message:
    More updated project properties files for the sparkTest project.
    Modified Paths:
        flex/sdk/trunk/development/eclipse/flex/sparkTest/.actionScriptProperties
        flex/sdk/trunk/development/eclipse/flex/sparkTest/.project

    Thats good news.

  • Alternatives to loading .properties files for every request

    I am just starting for a company, and they loading a bunch of .properties files for every request. I've told them that according to JEE specs, using the file system like that is a violation, as it's not scalable. I've suggested the following alternatives:
    1. Load a file once, in a static initializer, or something to that effect. Re-start the app if a change needs to be made in properties.
    +: few changes
    -: requires a new war/ear to make a change
    2. Put properties that are truly variable in a database record.
    -: requires DB schema change.
    3. For instance, i've though about using something like jconsole to change an mbean property, and then web apps using that property.
    4. Define a single web app that exposes an EJB/JMS/RMI object which serves properties to other web apps. If a change is needed, only 1 web app needs to be re-started, although it would still have to be re-packaged. Perhaps this app could load this stuff from the DB.
    5. Have a properties service, and expose it as an RMI object. If a change needs to be made on the fly, use rmi to make the updates.
    I'm leaning towards a combination of 1, 5, and possibly 4.
    I would like to know what other alternatives might be available.
    Thanks.

    I am just starting for a company, and they loading a
    bunch of .properties files for every request. I've
    told them that according to JEE specs, using the file
    system like that is a violation, as it's not
    scalable. well, it's just boneheaded that's all
    I've suggested the following alternatives:
    1. Load a file once, in a static initializer, or
    something to that effect. Re-start the app if a
    change needs to be made in properties.that's what most people do
    2. Put properties that are truly variable in a
    database record.well, databases don't normally hold config info, but you can do what you want
    -: requires DB schema change.
    3. For instance, i've though about using something
    like jconsole to change an mbean property, and then
    web apps using that property.
    4. Define a single web app that exposes an
    EJB/JMS/RMI object which serves properties to other
    web apps. If a change is needed, only 1 web app needs
    to be re-started, although it would still have to be
    re-packaged. Perhaps this app could load this stuff
    from the DB.doing EJB or RMI for getting properties sounds like overkill in the extreme to me

  • How can i write properties file for Hindi font

    Hi All,
    i'm using jdev 11.1.1.5.0
    in my use case i have worked on internationalization where i want to use hindi font
    like this link -
    Majid Hussain: Internationalization of ADF 11.1.1.3 Applications
    as in above post majid used german language and write properties file for german language(which is using english character).
    but my problem is that i want to use hindi language
    so how can i write propery file which support hindi font.
    Manish

    Hi Manish,
    We also had same requirement where we need to show indian local language(Hindi ,Bengali and many more ).
    We had implemented following approach and perhaps it will helpful for you.
    1-First we changed the encoding value in jdeveloper.
       go to jdeveloper --> tools --->preference-->encoding , select to UTF8
    2-We used to get the properties and it's translated value from business and then we were manually put these pair into related resource bundle.
    And using this we were able to implemented multilanguage support.
    Thanks
    Prateek

  • [svn:bz-trunk] 5125: Update excludes.properties file for BlazeDS/ trunk to exclude tests due to bugs BLZ-354, BLZ-355, and BLZ-356.

    Revision: 5125
    Author: [email protected]
    Date: 2009-03-02 05:55:42 -0800 (Mon, 02 Mar 2009)
    Log Message:
    Update excludes.properties file for BlazeDS/trunk to exclude tests due to bugs BLZ-354, BLZ-355, and BLZ-356.
    Also exclude JMS tests on WebSphere due to configuration issues on the regression box. This is being tracked by QETOOLS-32 in jira.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-354
    http://bugs.adobe.com/jira/browse/BLZ-355
    http://bugs.adobe.com/jira/browse/BLZ-356
    http://bugs.adobe.com/jira/browse/QETOOLS-32
    Modified Paths:
    blazeds/trunk/qa/features/excludes.properties

  • Use jar file for one servlet in one application (not global in classpath)

    I have a servlet application that needs a jar file to load with one particular servlet. If I put the classpath to the jar file in the jvm12.conf, the servlet loads fine. I can't run it like that, however, since I use another jar file by the same name in a different application. I would like to specify it only with the servlet that needs it. According to the online help file, it says more than one jar, zip, or class file can be specified in the servlet classpath, but that doesn't seem to be the case. We're running iPlanet 4.1. I've tried adding the classpath to the jar file after the classpath for the servlet itself (servlet.properties), but it gives the class not found error for that function. Is there a way to do this? Context.properties, maybe? I can't find any instructions on setting that up.

    You might have better luck asking this question on a web server forum. This is an application server forum and most people here are going to more experienced with iAS.
    David

  • URGENT!!! can I borrow a valid jserv.properties file for a JSP application ?

    Hi there !
    I'm running Oracle enterprise edition on NT with oracle http server under apache.
    I created a JSP application using jdeveloper
    and deployed it to the web server.
    Now I'm still getting getting nullPointer exceptions after I have modified the jserv.properties file according to the documentation
    Can someone give me a file that is working for her/him under the above described circumstances ?
    Many Thanaks in advance
    Tony
    null

    laredotornado wrote:
    Hi,
    This might not be a JSF question, but I thought I'd start here as I'm building a JSF application. Upon startup of my Weblogic 9.2.2 server, I see these error messages
    log4j:WARN No appenders could be found for logger (org.apache.myfaces.webapp.StartupServletContextListener).
    log4j:WARN Please initialize the log4j system properly.
    One complication, my log4j.properties file is actually called "my.properties" (bizarre company reason). Is there somewhere in my faces-config.xml file or an equivalent where I can indicate what log4j properties file I'd like to use?Your company policy is to use non-standard names so that things must be configured manually? Interesting.
    In the past people created a servlet those sole purpose was to configure log4j in the initialization sequence and then do nothing.

  • JSF Properties File for Images

    I got a .war file where all my jsps are, including my JSF properties file that include a path(outside my .war file), for example:
    urlWatermark=file:///C:/SA/images/watermark.jpg
    Then in my JSP page:
    <f:loadBundle basename="jsfks.bundle.image" var="msgImage" />
    <c:set var="pageWater" scope="session">               <h:outputText value="#{msgImage.urlWatermark}" />
    </c:set>
    <img src="${pageWater}" />
    but it dont want to display my image, as when i view the source in the browser, it shows:
    <img src="file:///C:/wesbankSA/images/watermark.jpg" />
    how can i change this so that the image will display.
    thanks

    so I have to write 2000 lines of code just to reference images, outside my war
    file, using a JSP props file?No. Re-count the lines of the last given ImageServlet example (you may skip comments) and read the given examples how to use it.
    Isnt there a simpler way of doinig thisYes, copypaste the ImageServlet code, change it where needed (at least the base path, the rest can be kept default), define this servlet in your web.xml, change your <img> or <h:graphicImage> tags to make use of it and run it.

  • How to create a properties file for DB connection (BPEL async processes)

    Hi,
    In BPEL asynchronouns Project, I am trying to create the Database connection. Instead of hardcoding the details, I want to put it in the properties file and then import the connection file in order to create a connection.
    I am very new to BPEL and need urgent help. Hoping for a quick reply..
    Thanks

    So, what would be the practical approach for implemeting this. When I use "Import Connections" option, in help I get this:
    "File Name:
    Click Browse to locate a file containing the connection descriptor(s) that you want to import. Select the file and click Open. Connection descriptors are saved to XML files. The recommended file extension is .xml. You can import connections from previous versions of JDeveloper by importing connections from IDEConnnections.properties in the earlier installation. You can import connections from other versions of JDeveloper by importing connections from IDEConnnections.xml. "
    Please suggest.

  • How can load properties file for one time and use in entire application

    Hi folks,
    I dont want to read properties file every time , and want to get property value in any servelet or jsp page.(means i want to read only property file only for once and want to get value in any where ) , how to do this.
    Message was edited by:
    RajeshwarReddyT

    means we have to read file every time Know but i dont
    want to be happen that ??? No you don't . You read the file once. You store it in the hashmap. Then you hand that hashmap to whatever class needing the data.
    getProperties() returns the hashmap, doesn't read the file.
    Maybe I should have called the method getMap or something.
    Message was edited by:
    karma-9

  • Sample md.properties files for bulk loader

    Hi,
    I wanted to use bulk loader to load the content into BEA repository.
    Can some one paste the sample dir.md.properties file and content properties file
    please?
    greatly appreciate your help!!
    Regards,
    Subba

    Alex,
    Thanks for your help!!
    Regards,
    Subba
    "alex toussaint" <[email protected]> wrote:
    >
    >
    >
    >
    Hi Subba,
    You can find an example of the "dir.md.properties" file at:
    <install_dir>\weblogic81\portal\db\data\sample\cm_data\Ads
    The content for this "dir.md.properties" is just:
    nodeType=ad
    Regards,
    --alex
    "subba" <[email protected]> wrote:
    Hi,
    I wanted to use bulk loader to load the content into BEA repository.
    Can some one paste the sample dir.md.properties file and content properties
    file
    please?
    greatly appreciate your help!!
    Regards,
    Subba

  • How big is too big for .properties file for a ResourceBundle?

    The subject says it all. We are using ResourceBundles to manage the dictionary of English/French literals for our web enabling project. Our .properties file is currently 675 key/value pairs. How big can .properties files grow before they are too big?
    Thanks,
    Don Booker - Programming Team Leader
    Common Departmental Financial System
    Public Works & Government Services Canada

    The resource gets loaded into memory, so there's a memory cost that increases with the number of properties. (There's also a time cost when it loads, but that's only once.) And finding one of the properties requires a search, so there's a processing cost involved. But it's based on a Hashtable, so it isn't a major cost even if the number of properties gets very large.
    So there's your constraints. The question is, though, what is your alternative when the resource does get too big? A database? That reduces the memory cost but increases the processing cost. I would guess you could let your properties file grow a lot before you were forced to go to a database, but actual testing would help.

  • What values to place in signer.properties file for Webutil configuration

    Hi. I'm not sure of what value to place in JDK_HOME in signer.properties for Webutil configuration. My current settings are:
    JDK_HOME=D:\ora9i\jdk
    JINIT_HOME=C:\Archivos de programa\Oracle\JInitiator 1.3.1.13
    #Certificate settings:
    # These are used to generate the initial signing certificate
    # Change them to suite your organisation
    DN_CN=Product Management
    DN_OU=Development Tools
    DN_O=Oracle
    DN_C=US
    JAR_KEY=webutil
    JAR_KEY_PASSWORD=webutil
    Is JDK_HOME the jdk for oracle or SDK for windows machine(how to find?)?. Also how do i repeat the process of makecert and signing of webutil.jar and jacob.jar?. If i try to repeat this process I get the following warnings or error?
    Makecert:
    keytool error: java.lang.Exception: Key pair not generated, alias <webutil> already exists
    Certificate created...

    JDK_HOME is just the location of a Java distribution with Keytool in it - have a look at the signer batch file and you'll see how each variable is used. Also if you run keytool from the command prompt it will show you the commands to delete and existing Key or list the keys that are currently stored.

Maybe you are looking for

  • Create Sales Order with reference to Quote for different customer

    HI Expert Any idea how I may be able to do this? Create Sales Order - for Customer B (VA01) with reference to a completed Quote for Customer A. While keeping the line items, quantity and pricing exactly the same. Quote - Customer A - >  Sales Order -

  • Install a samsung 830 SSD in my macbook pro 2011.

    I am trying to install a samsung 830 SSD in my brand new Macbook pro. Whenever I install it and boot the mac I get three beeps. When I put the old HD back in it workes fine. The SSD workes fine on a windows machine. I have seen other macbooks with th

  • Problem logging into essbase studio in windows 7 -64bit-

    hi everyone I have a problem logging into Essbase studio as i have installed Essbase foundation 11.1.3 and Essbase server in windows 7 "64bit" version when ever i try to log into Essbase studio it gives me this error Error connecting to Essbase serve

  • BT SmartTalk - addon services don't apply?

    Apologies but I mistakenly posted this in the "Phones" forum, when it seems that it applies more here.  Anyway... I just had an interesting conversation with some customer services person.  It seems that International Freedom doesn't apply to BT Smar

  • Create new DataFile in another partition??

    Hi, I used database oracle10g, and I set (oradata) in partition (C) and i want to load large data on database but i haven't enough space in this partition . Can I create new DataFile in another partition like partition (D) ??? And if yes, will it eff