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.
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>
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;
}
}
}
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.
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?
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.