This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes How to display InputSream dynamically on a JSP page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSP
Bookmark "How to display InputSream dynamically on a JSP page?" Watch "How to display InputSream dynamically on a JSP page?" New topic

How to display InputSream dynamically on a JSP page?

Vijendra Prakash

Joined: Jul 24, 2011
Posts: 4
What I want to do is to display the console output in the JSP. I am getting the Stream to be displayed dynamically. The objective is to execute some commonly used shell scripts on remote servers and display the console which gets displayed when one manually logs on to the server and runs those scripts. I am stuck with the displaying part of it. Remote scripts are getting executed well and I am able to print the console output to local console, but I want to display it dynamically in the browser page. Here’s a code snippet which executes the shell script and gives the required stream.

Now we have number of servers where different scripts are to be executed time and again. So displaying different server’s console in different tabs. Number of servers are pre-configured in an xml.
I am displaying different tabs as follows:

Now what I want to do is to have 3 buttons on each tab. And on clicking on each of those buttons send a AJAX call which will execute a script on that particular host and display the console output in a div next to these buttons. Also want to have only one div which will be common to all the three buttons and display console in that one div itself. One div per tab/host.
What I have done is to write the console output to a log file and read the log file in a custom tag as follows:

The problem here is that I am not able to close the stream as I never know when to stop reading the log file. Also div isn’t closed and will not work for more than one tabs. Can someone please suggest a way to get the console printed properly for all tabs?
Have you checked out Aspose?
subject: How to display InputSream dynamically on a JSP page?
It's not a secret anymore!