In Jess 5, making Jess's "standard output" go to a servlet's output is
extremely easy.  Say you've got a Rete object in a variable named
'engine', and an HttpServletResponse in a variable named 'res'. Then:


   engine.addOutputRouter("t", res.getWriter());

That's it! The Jess 5.0a6 manual, section 4.4.6, explains everything
you need to know about output routers.

At this point Jess 5 is stable enough that I'm recommending everybody
use it rather than 4.4. This would be somewhat harder to accomplish in
Jess 4, anyway.

I think Message UK wrote:
> 
> Thanks Danny, that is helpful. I have no GUI yet, I'm just starting with my 
> servlet stuff and I have servlets like Hello World running just fine on my 
> PC using the built in web server with JDSK and I got the O'Reilly servlets 
> book...
> 
> I guess what I need to know how to do is take the javacsript or output 
> strings from the RHS of my rules in jess, and have the servlet interpret 
> them. There must be a simple way to do it! Main produces output to standard 
> output, so how do I "capture" the output, or better still, change the output 
> stream from standard to "internal" (if you know what I mean!!!)?? I'll work 
> out the http get and post stuff, I have the text for that. I just have very 
> littl eexperience with output stream stuff.
> 
> Thanks so much for your help. ANy comments welcome!!!
> 
> >
> >Hi,
> >A lot will depend on how the servlet is to be used - servlets are based 
> >around HTTP
> >comms, so if you're wanting e.g. user interaction you will have fun sorting 
> >out
> >what messages to send from form post operations etc. It is remarkably
> >straightforward to stick an application that doesn't have a lot of GUI 
> >stuff - you
> >pretty much just take the code from within your main class and bung it in a 
> >servlet
> >class e.g.
> >public class WasMyMain extends HttpServlet{
> >I haven't really looked at it, but I guess that you would be able to do 
> >redirection
> >from the Jess UI to HTTP, but this could get a bit fiddly - I'd be tempted 
> >to strip
> >down the front end a bit first and then build a HTTP-based GUI from scratch 
> >(no as
> >bad as it sounds - doesn't need much more than HTML).
> >I don't know if you've already done this, but it can take a while to get 
> >the
> >servlet runner (Jserv or whatever) going right on your web server - what 
> >I'm trying
> >to say is, get HelloWorldServlet working first before attacking the Jess 
> >code.
> >The Java Tutorial is pretty good on servlets :
> >http://java.sun.com/docs/books/tutorial/servlets/index.html
> >and there's the mailing list :
> >[EMAIL PROTECTED]
> >I'd love to hear how you get on.
> >Cheers,
> >Danny.
> >
> >
> >Message UK wrote:
> >
> > > Hello. I'm hoping to write a servlet which will run JESS, and I'd like 
> >to
> > > know if I can do so **simply**, by taking the output of jess.Main and 
> >have
> > > the servlet use this output. I read that the output stream can be 
> >altered,
> > > so rather than standard output I'd send it to the servlet. Any help? I 
> >have
> > > seen an example of a servlet by RF Grove but that's a bit too complex 
> >for my
> > > needs!
> > >
> > > Many thanks. Debbie Lampon
> > >
> > > ______________________________________________________
> > > Get Your Private, Free Email at http://www.hotmail.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]
> > > ---------------------------------------------------------------------
> >
> >
> >---------------------------------------------------------------------
> >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]
> >---------------------------------------------------------------------
> >
> 
> 
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.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]
> ---------------------------------------------------------------------
> 
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9214                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

---------------------------------------------------------------------
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]
---------------------------------------------------------------------

Reply via email to