On Mar 28, 2007, at 3:00 PM, [EMAIL PROTECTED] wrote:
Hi, I have this so far which works Ok but it means the "output" window
opens in a new window/frame and as such cannot be closed by
clicking on
the normal close glyph (minimize and maximize/restore work fine)
until my
Tomcat server is closed down which does so unwillingly, even by
closing
the parent servlet window which opened the "output" window in the
first
place. Is there a way to display the "output" window in the current
servlet window rather than in a new window/frame as I think this
would be
better? Any ideas why the "output" window won't close properly?
Thanks.
You're opening a Swing window, running in the servlet, which is why
it's tied to Tomcat. If you want to send the output to the HTML page,
then send it to the HTML page -- i.e., use "engine.addOutputRouter
("t", response.getWriter());", and don't use any of the
TextAreaWriter stuff!
-------------------------------------------------------
import jess.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.awt.*;
import jess.awt.*;
public class servlet extends HttpServlet {
public void doGet (HttpServletRequest request, HttpServletResponse
response)
throws IOException, ServletException {
response.setContentType("text/html");
Rete engine= new Rete();
try {
TextArea ta = new TextArea(20, 80);
TextAreaWriter taw = new TextAreaWriter(ta);
Frame a = new Frame("Output");
a.add(ta);
a.pack();
a.setVisible(true);
engine.addOutputRouter("t", taw);
engine.addOutputRouter("WSTDOUT", taw);
engine.addOutputRouter("WSTDERR", taw);
engine.executeCommand("(batch main.clp)");
} catch (JessException ex) {
ex.printStackTrace();
} catch (Exception ex) {
throw new ServletException(ex);
}
}
}
-------------------------------------------------------
On Mar 27, 2007, at 2:29 AM, [EMAIL PROTECTED] wrote:
Hi,
I have Jess embedded in a Servlet and was wondering if there was an
alternative to getting Jess to printout to the console window
like for
example printing to the Servlet web page for times when the console
is not
available for viewing?
You could just pass the ServletOutputStream into Jess and use its
methods directly, or if you want to get fancy, the Jess manual
describes how to write your own "output router", the mechanism for
using Jess's "printout" function to print to any arbitrary Java
stream (it's very easy.)
---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users
[EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify owner-jess-
[EMAIL PROTECTED]
--------------------------------------------------------------------
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users
[EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify owner-jess-
[EMAIL PROTECTED]
--------------------------------------------------------------------
---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------