I am running a Java application through my JSP page.
is it possible to redirect everything that the Java app prints into System.out into my page?
Edit:
I have a package pkg which contains a main function. this function has lots of System.out.println calls. e.g.
package pkg;
public class pkg {
public static void main(String[] args) {
System.out.println("Hello");
}
}
In my index.jsp I call:
<%
pkg.pkg.main(new String[] {});
%>
I need to see everything the pkg.pkg.main prints on the page. e.g.
Hello
Refactor the code of the called class so that it takes a Writer as argument, and print to this Writer rather than System.out:
and call this second main method from your JSP (which should be a servlet):