Results 1 to 6 of 6

Thread: Java properties / variables dynamically

  1. #1
    Join Date
    Dec 2009
    Posts
    292

    Java properties / variables dynamically

    Hello,
    I want a process to consider dynamically (real time) a property or variable is defined in a file, or db, or environment variable. I have a Web interface with menus. I want these menus displayed or not depending on the value of my property / variable. Any help on this is highly appreciated. Thanks in advance.

  2. #2
    Join Date
    Nov 2009
    Posts
    347

    Re: Java properties / variables dynamically

    Hello,
    The following code may be helpful to you. Just have a look at it
    Code:
    <head>
    ...
    <script>
    var o = setInterval("nmmethd ()", Interval);
     
    / / Function called every "interval" milliseconds ...
    function nmmethd()
    {
    ...
    }
    ...
    </ head>
    ...
    </ script>

  3. #3
    Join Date
    Nov 2009
    Posts
    518

    Re: Java properties / variables dynamically

    Hello,
    I am new to this concept, I have not done much programs on this, but I have a code for you, see if this helps you.
    Code:
    function getXMLHttpreq()
    {
       
        // =======
        if ( win.XMLHttpreq ) return new XMLHttpreq(); 
     
        / / Internet Explorer
        // =================
        if ( win.ActiveXObject ) return new ActiveXObject("Microsoft.XMLHTTP"); 
     
        / / Not supported
        // =============
        return null;
    }
    
    function appelAjax()
    {
       htreq = getXMLHttpreq();
       if ( htreq == null ) return;
    
       var req = "http://localhost:8080/Site/....";
       var par = "action = extract & id = 500";
    
       htreq.open("POST", req, true);
       htreq.setreqHeader("Content-type", "application / ......");
    
       htreq.Send(par);
       htreq.onhand = Function()
       {
          if ( parseInt(htreq.readyState) == 4 )
          {
              var res = htreq.responseText;
          }
      }
     
    }

  4. #4
    Join Date
    Nov 2009
    Posts
    335

    Re: Java properties / variables dynamically

    Hello,
    An amendment to the xml file it is properly taken into account instantly by the web server? Example: a link in a menu is displayed or not according to a parameter described in a xml file. If this xml file is changed on the server to disable the display of the link, change will be taken into account from the next menu display? I hope you are getting the concept behind it. If you have more queries regarding this then please do post back.

  5. #5
    Join Date
    Nov 2009
    Posts
    356

    Re: Java properties / variables dynamically

    Hello,
    I completely agree with the above post, I would like to add to it. I know there is a parameter (on Tomcat) to automatically reload files that have changed in the WEB-INF/classes and WEB-INF/lib directories. In my case, being a web application into production, it is not advisable to use this mechanism. I wanted to know if the mechanism you suggest Obutterlin (via Ajax) can actually create this type of operation?

  6. #6
    Join Date
    Nov 2009
    Posts
    359

    Re: Java properties / variables dynamically

    Hello,
    After some tests under Tomcat, I have observed that changes in the xml file are taken into account only reboot the server. I have thought to use a Boolean field in the database, but something simpler would be welcome. Someone would have an idea? Any help regarding this topic is appreciated. If you have any other alternative then please let me know. Thanks in advance.

Similar Threads

  1. What are an Atomic Variables in Java?
    By Dilbert in forum Software Development
    Replies: 5
    Last Post: 04-01-2011, 07:51 PM
  2. About instance variables in java
    By Khaled11 in forum Software Development
    Replies: 1
    Last Post: 19-03-2010, 02:38 PM
  3. What is Instance variables in Java?
    By Owen Fernandes in forum Software Development
    Replies: 5
    Last Post: 23-01-2010, 08:27 AM
  4. Multiplying Variables in java
    By WinDoWLoCuS in forum Software Development
    Replies: 3
    Last Post: 03-12-2009, 01:43 PM
  5. Problem Passing Data Dynamically in Java
    By Kushan in forum Software Development
    Replies: 3
    Last Post: 26-03-2009, 02:26 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,651,546.20941 seconds with 16 queries