Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Java properties / variables dynamically

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 04-03-2010
Member
 
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.

Reply With Quote
  #2  
Old 04-03-2010
Member
 
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>
Reply With Quote
  #3  
Old 04-03-2010
Member
 
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;
      }
  }
 
}
Reply With Quote
  #4  
Old 04-03-2010
Member
 
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.
Reply With Quote
  #5  
Old 04-03-2010
Member
 
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?
Reply With Quote
  #6  
Old 04-03-2010
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Java properties / variables dynamically"
Thread Thread Starter Forum Replies Last Post
What are an Atomic Variables in Java? Dilbert Software Development 5 04-01-2011 06:51 PM
About instance variables in java Khaled11 Software Development 1 19-03-2010 02:38 PM
What is Instance variables in Java? Owen Fernandes Software Development 5 23-01-2010 07:27 AM
Multiplying Variables in java WinDoWLoCuS Software Development 3 03-12-2009 12:43 PM
Problem Passing Data Dynamically in Java Kushan Software Development 3 26-03-2009 02:26 PM


All times are GMT +5.5. The time now is 11:04 AM.