Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a wmi c++ program
i want to display the output of the program in the web browser using tomcat
can anyone help me with that

What I have tried:

i don't know what to do.
i did not tried any thing
Posted
Updated 19-Jul-18 1:56am

1 solution

Let the C++ application create HTML file(s) that are stored in the document path of the web server. If there is only one file, it can be stored in the root path of the server using the start page file name (usually index.htm[l]). Then it will be shown when navigating to the server URL. Otherwise you have to provide a start page with link(s) to the HTML file(s) generated by your application or enter the full URL in the browser.
 
Share this answer
 
Comments
Member 13906075 19-Jul-18 12:43pm    
Any examples? Because i have just started with tomcat
My cpp program generates a output whenever a file or folder is created
Using wmi
Whenever the output changes i want to display the output by appending it to the page
Jochen Arndt 19-Jul-18 13:08pm    
It is not related to Tomcat (or any other web server) besides having that running, knowing the local document root path, and navigating to your page in the browser.

You have to create a valid HTML file.

Do you know the the document root path of your web server?
Store the file there or in a sub directory.

Do you know how to create a file with C/C++?
Do it.

Do you know (at least a little bit) HTML?
Write your ouput in HTML.

When you have to update the file, do that. Create either a completely new file or locate the position in your existing file where to insert the new data.

Note also that you can't automatically show a page in a web browser. You have to first open the page in the browser manually. There is also no standard HTML 4 method to inform that a shown page has been changed. It requires recent technologies like HTML 5 or websockets, or using scripting frameworks.

If you know the interval of changings, the simplest method would be using the
<meta http-equiv="expires" content="0">
header tag to tell the browser that it should not load the page from the cache and
<meta http-equiv="refresh" content="interval_in_seconds" url="the_url_of_this_page"> to reload the page every interval_in_seconds.

For reloading you might also use a JavaScript timer that calls
window.location.reload(true);
which forces also by the true parameter reloading from the source instead of the cache.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900