Storing configuration in JSF - what is the best practice

Hello,
I would like to know how I should store my webapp configuration. At the time being I have the settings in a .properties file. The problem is that it is compiled in the war file. Thus, I do not know how I could edit the file via my application. I want to enable the user to change the configuration.
Another possibility would be to store that in a database. But I do not believe it is the best available solution. Though, I cannot find any satisfying answer to this question anywhere.
Jan

I am sorry, I wrote that in short. I used the way of File -> FileOutputStream but it did not work.
Now it is working, hooray. Thank you! But I would like to have the possibility to determine where exactly the properties file should be.
I have three paths in my classpath - two of them are some Tomcat folders. I do not have the root path there (C:/).
// the file is found in the classpath: F:/Program Files/Apache Software Foundation/Tomcat 5.5/shared/classes/
InputStream is = getClass().getResourceAsStream("/prop.properties");
// Then writing:
// try-catch etc. left out here
File file = new File("propx.properties");
OutputStream os = new FileOutputStream(file);
prop.store(os, null);I set a different file name to be sure it is that new one.
That creates the property file in F:\Program Files\Apache Software Foundation\Tomcat 5.5\bin directory which I consider being strange because it is not in the classpath.
When I used "/propx.properties" (the slash at the beginning), the file was saved to C:/ which is not in the classpath either.
It would be great to be able to determine where exactly it should be created.

Similar Messages

  • What are the best practice for CQ5.5 configuration?

    Hello,
    What are the best practice for CQ5.5 configuration which handle for High availability.
    Last time I had a issues on server when I was uploaded 2 GB of DAM and then after that the server is not able to start and always getting error regarding Tar Persistance.
    So kindly request you to please let me know what are the best apache felix configuration.
    Thanks in advance...
    Regards,
    Satish

    Hi,
    A DAM upload, regardless of the size of the assets, never should result in TarPM problems, unless you run into an OOM, which left the repository in an unclean state. So if you regularly do DAM uploads of that size, you should check the Garbage Collection logs and probably adjust the heapsize if necessary. You might want to limit the number of concurrent running workflows to keep the memory consumption a bit lower.
    To your question: HA in a traditional sense you cannot achieve with a single box, even with optimized settings. In an author usecase you would need clustering.
    Jörg

  • What is the best practice to handle JPA methods in JSF app?

    I am building a JSF-JPA web app(No EJB).
    I have several methods that has JPA QL inside.
    Because I have to put those methods inside JSF beans to inject EntityManagerFactory (am I right about this?).
    And I do want to separate those methods from regular JSF beans which are used by page authors.
    And I may need to use them in different JSF managed beans.
    My question here is that what is the best practice to handle that?
    I. write a or a few separate JSF Beans and inject them into regular Beans?
    II. write a or a few separate JSF Beans and access them into regular Beans using FacesContext?
    III. others?
    Waiting to hear from you opinions.

    You can create named queries on your Entities themselves then just call entityMgr.createNamedQuery("nameOfQuery");
    Normally, we put these named queries in the class of the entity which will be returned. This allows for all information pertaining to a given entity and all ways of accessing that entity (except em.find() and stuff, of course) to be in one place. As long as the entity is defined in your persistence.xml file, any named queries which reside on that entity will be available through the EntityManager.
    As for the EntityManagerFactory, we normally create an application scope bean which holds the factory itself (because this is a heavy-weight object) and then just get all EntityManager instances from that by injecting this bean into whatever needs it. For example, I might have:
    //emfBB is the injected app scope bean which holds the entity manager factory.
    private EmfBB emfBB;
    private void lookupSomeData()
    EntityManager em = this.getEmfBB().getEmf()
    I hope this answered your question?
    ~Zack
    Edited by: zmarr on Nov 6, 2008 1:29 PM

  • What is the best practice for changing view states?

    I have a component with two Pie Charts that display
    percentages at two specific dates (think start and end values).
    But, I have three views: Start Value only, End Value only, or show
    Both. I am using a ToggleButtonBar to control the display. What is
    the best practice for changing this kind of view state? Right now
    (since this code was inherited), the view states are changed in an
    ActionScript function which sets the visible and includeInLayout
    properties on each Pie Chart based on the selectedIndex of the
    ToggleButtonBar, but, this just doesn't seem like the best way to
    do this - not very dynamic. I'd like to be able to change the state
    based on the name of the selectedItem, in case the order of the
    ToggleButtons changes, and since I am storing the name of the
    selectedItem for future reference.
    Would using States be better? If so, what would be the best
    way to implement this?
    Thanks.

    I would stick with non-states, as I have always heard that
    states are more for smaller components that need to change under
    certain conditions, like a login screen that changes if the user
    needs to register.
    That said, if the UI of what you are dealing with is not
    overly complex, and if it will not become overly complex, maybe
    states is the way to go.
    Looking at your code, I don't think you'll save much in terms
    of lines of code.

  • Terabyte Plus Libraries - What is the Best Practice?

    In my current Aperture library I have 150 gigs and I have only been using it for about a year. Previous to that I used iPhoto for a short time which still has a 60 gig library and previous to that I stored my images in file folders on a windows servers which I have around 500+ gig there. Then there are are those non electronic images which should be scanned in one day.....
    My hope was to have import everything into one tool and eventually to have some better organization and management of my images. At the rate I am shooting now it won't be long before I break the terabyte mark and am wondering as I try to pull al these sources together what is the best Practice?
    I know I can have more than one library now with Aperture, do folks manage their libraries by themes? Weddings, Family, Commercial, etc? I just picked up a 2 terabyte drive to start moving stuff off my Mac Book but am not sure if I should use the Archive tool to do this or break apart my images into libraries and store them them and just keep a working library on my Mac?
    Within Aperture I am using the Project -> Album hierarchy to manage my shoots now as well.
    Also, I don't have a ton of video yet, but have started shooting a little, plus have been making slideshows and books now, so I need to start planning for that as well. Just wondering what is the best, most efficient way of large data management with Aperture.
    Thanks!

    The solution is to avoid the (unfortunately default) Managed Masters and instead use a Referenced Masters Library kept on an internal drive. Back up originals prior to importing and keep Masters off the Library drive. That way the Aperture Library will remain small enough to live on a standard internal drive without overfilling it.
    Note that working drives (as opposed to backup-only drives) should not be allowed to exceed ~70% full for ideal speed and stability.
    Multiple Libraries is almost always poor images management in a digital world unless all rights to the images, including the right to simply view any image (such as security work), belong exclusively to the client. Usage of multiple Libraries is a big backward step into film-think and very significantly limits the power of digital images management.
    -Allen

  • What is the best practice to perform DB Backup on Sun Cluster using OSB

    I have a query on OSB 10.4.
    I want to configure OSB 10.4 on 2 Node Sun Cluster where the oracle database is running.
    When im performing DB backup, my DB backup job should not get failed if my node1 fails. What is the best practice to achieve this?

    Hi,
    Each Host that participates in an OSB administrative domain must also have some pre-configured way to resolve a host name to an IP address.Use DNS, NIS etc to do this.
    Specify cluster IP in OSB, so that OSB always looks for Cluster IP only instead of physical IPs of each node.
    Explanation :
    If it is 2-Node OR 4-Node, when Cluster software installed in these nodes we have to configure Cluster IP so that when one node fails Cluster IP will automatically move to the another node.
    This cluster IP we have to specify whether it is RMAN backup or Application JDBC connection. Failing to second node/another Node is the job of Cluster IP. So wherever we install cluster configuration we have to specify in all the failover places specify CLUSTER IP.
    Hope it helps..
    Thanks
    LaserSoft

  • What's the best practice to manage the page file?

           
    We have one Hyper-v Server running windows 2012 R2 with 128 GB RAM and 2 drives (C and D). It setup Automatically manage page file size for all drives. What's the best practice to manage the page file?
    Bob Lin, MCSE & CNE Networking, Internet, Routing, VPN Networking, Internet, Routing, VPN Troubleshooting on http://www.ChicagoTech.net How to Install and Configure Windows, VMware, Virtualization and Cisco on http://www.HowToNetworking.com

    For Hyper-V systems, my general recommendation is to set the page file to 1-4 GB. This allows for a mini-dump should something happen. 99.99% of the time, Microsoft will be able to figure out the cause of the problem from the mini-dump. It does not make
    sense on a Hyper-V system to set aside enough space to capture all the memory on the system because only a very small portion of that memory is used by the parent partition. Most of the memory is under control of the individual VMs.
    Yes, I had one of the Hyper-V product group tell me that I should let Windows manage it.  A couple of times I saw space on my system disk disappear because the algorithm decided it wanted all the space for the page file.  Made it so I couldn't
    patch my systems.  Went back in and set the page file to 1-4 GB and have not had any issues since.
    . : | : . : | : . tim

  • What is the best practice concerning View Objects and List of values

    Hi,
    Let's take these two tables :
    Market_Descriptions
    Id
    Name
    Desc
    Language_Id
    Languages
    Id
    Code
    Desc
    Now, if I am generating these business components with the help of the wizard, I will be having two entities and two views.
    If I am creating a list of value on the field Language_Id in Market_Descriptions table, showing the language code, everything works fine as long as this is drop as a Form but not as a table or read-only form.
    What is the best practice for me to include/replace the language_id with the language code, since it is more user-friendly, on a read-only form or a table?
    Thanks.

    Hi,
    Always have LOV on the field which we want show it on UI. Suppose based on below scenario, If you want to display Langaugae Description on UI, have LOV on Desc but not on Language_Id. Even though we can set display attribute in LOV configuration, but it will work only in forms but not in tables. In tables it will show language id instead of description.
    Have LOV on Desc and make one more join with location Id in LOV configuration, so as soon as we select desc in LOV, location_id will be populated.
    here is the join condition inside LOV
    Languages.Desc = ViewAccessor.Desc
    Languages.Id - ViewAccessor.Desc
    Hope this will help you.
    Dileep.

  • What is the best practices recommended from microsoft to give access a intranet portal from internet externally

    Hi
    what is the best practices recommended from microsoft
    i have a intranet portal in my organization used by employees  and i want to give access for employees to access external from  internet also
    can i use same url  for employees access intranet portal from internally and externally or diffrent url?
    like ( https://extranet.xyz.com.in)  and (http://intranet.xyz.com.in)
    internal url access by employees is( http://intranet.xyz.com.in)
    and this portal configured with claims based authentication
    here i have a F5 for load blance and
     a request from external to F5 is https request and F5 to sharepoint server http request
    and sharepoint server to F5 is http request but F5 to external users it is https response so 
    when i change below settings in alternate access mapings   all links changed to https
    but only authentication link is still showing http and authentication page not opened.
    adil

    Hi,
    One of my clients has an environment similar to yours with an internal pair of F5s and a pair used for the access from the internet. 
    I am only going to focus on the method using an F5 Load Balancer and SSL Offloading. the setup of the F5 will not be covered in detail but a reference to the documentation to support SharePoint and SSL Offloading will be provided
    Since you arte going to be using SSL Offloading you do not need to extend your WebApps to use separate IIS WebSites with Unique IP Addresses
    Configure the F5 with SSL Offloading
    Configure a Internal AAM for SSL (HTTPS) for each WebApp that maps to the Public HTTP FQDN AAM Setting for each WebApp
    Our environment has an additional component we require RSA Authentication for all internet facing Sites. So we have the extra step of extending the WebApp to a separate IIS WebSite and configuring RSA for each extended WebSite.Reference:
    Reference SharePoint F5 Configuration:
    http://www.f5.com/featured/video/ssl-offloading/
    -Ivan

  • When displaying just One WDiView in the Portal what is the best practice?

    Hi,
    I´m configuring some Roles to display WebDynpro iViews and I´m concerned because when a page has to display just one iView I don´t create the Page but instead I call the iView directly into the Role and the Displayed iView is viewed correctly, my concern began cause I´m checking SAP standard roles, WDiviews and WDPages and eventhough there is just one WDiView to be displayed a WDPage is been created to display it and the WD page id assigned to the Role.
    Does anyone knows what is the best practice in this case?
    Thanx in Advanced and Kind Regards,
    Gerardo J

    there is no harm in assigning iview directly to a role but usually assigning to a page ,page to a workset and workset to a role is followed universally

  • What is the best practice for logging runtime error  or uncheked exceptions

    hello
    my main problem is logging the nullPointerException to a file
    suppose I have this method
    public void myMethod()
       //..... some declaration here
       User user = obj.findUser("userx"); //this may return null
       System.out.println("user name is "+user.getName()); // I may have a null pointer exception here
    }so what is the best practice to catch the exception ??
    can I log the exception without catching it ???
    thank you

    A terrible way of logging exceptions.Not that im not agreeing with you, but why? (I havent
    actually used this)Because it's always on, for one thing. It's not really configurable either, unless you go to some trouble to make it so. You'd have to provide an InputStream. How? Either at compile-time, which is undesirable, or by providing configuration, which a logging framework has already done, better. Then there's the fact that you can't log anything other than the stacktrace - not particularly helpful a lot of the time. In short, it's a buggy and incomplete solution to something that's already been solved much much better by, for example, Log4J

  • What is the best practice for voicemail migration?

    Hello Tech Gurus,
    Am looking into a way to migrate our customer voicemail where their voicemail is on NME-CUE module. They want to migrate their voicemail's configurations, licenses and related (to SRE module) and I would like to know what is the best practice or guidelines that I can refer to.
    Thank you very much!
    Regards,
    Alex.

    Hi Alex,
    I was seeing the DOC  which says that 
    Cisco supports transfer of CUE licenses, with some restrictions. Transfer is supported for CUE devices that are of the same type, for an RMA or in cases in which a license was wrongly installed. This process is not intended for transferring licenses from one generation to another (for example, from NM-CUE to NME-CUE, or from NME-CUE to SRE devices). Transferring a license is accomplished using a process called rehosting. The rehosting process transfers a license from one UDI to another by revoking the license from the source device and installing in a new device
    http://www.cisco.com/c/en/us/td/docs/voice_ip_comm/unity_exp/rel7_1/Licensing/CUELicensing_book/csa_overview_CUE.html#wp1101175
    You can still speak to licensing team along with show license udi from SRE module along with old licenses details from NME-CUE fro rehosting.
    regds,
    aman

  • What are the best practices to connect 30-40 iPads to Wi-Fi in a single room?

    What are the best practices to connect 30-40 iPads to Wi-Fi in a single room?

    I don't use it but it does say this in the help section...

  • What are the best practices to migrate VPN users for Inter forest mgration?

    What are the best practices to migrate VPN users for Inter forest mgration?

    It depends on a various factors. There is no "generic" solution or best practice recommendation. Which migration tool are you planning to use?
    Quest (QMM) has a VPN migration solution/tool.
    ADMT - you can develop your own service based solution if required. I believe it was mentioned in my blog post.
    Santhosh Sivarajan | Houston, TX | www.sivarajan.com
    ITIL,MCITP,MCTS,MCSE (W2K3/W2K/NT4),MCSA(W2K3/W2K/MSG),Network+,CCNA
    Windows Server 2012 Book - Migrating from 2008 to Windows Server 2012
    Blogs: Blogs
    Twitter: Twitter
    LinkedIn: LinkedIn
    Facebook: Facebook
    Microsoft Virtual Academy:
    Microsoft Virtual Academy
    This posting is provided AS IS with no warranties, and confers no rights.

  • What are the best practices to replace a disk in 6140 ?

    What are the best practices to replace a disk in 6140?
    Regards

    The best way is to follow CAM Service Advisor instructions.

Maybe you are looking for

  • Help needed in getting values from the dynamically created text boxes

    Hello, I am developing one jsp page using struts. In the page i m dynamically adding some rows with two text boxes in each row. and after entering data into those textboxes , user clicks on save button and page is submitted. I want to capture all thi

  • SRM: Item category B/D for limit PO

    Hello Team, Want to pose a question ? When created a Limit PO into SRM (item category Limit), I found that the back-end PO replica is been created with item category D. Sounds starnge ? I believe i did build the system correct with new account assign

  • My new iphone 4 keeps saying it needs to be restored, but won't restore.

    My new today iphone 4 keeps saying that I need to restore it, but everytime I do it says at the end of the restore an error occured and the restore failed, and I can't use the phone until it's been restored....any help?!

  • Analog Input and Output in One Single VI

    I need help in setting both analog input and output in one single VI. How do I assign channels to be either input or output? How do I simultaneously uses both in one single VI with a while loop structure?? Which AO am I suppose to use to obtain signa

  • Is Corporate Governance offered in ECC 6.0 ?

    Hi Experts, Is Corporate Governance module provided in ECC 6.0 ? Regards Saurabh