Hi. I’m trying to get the ‘printout’ from Jess statement and put them into JSP. Does anyone have any example on that? Need some help.

 

Supposedly, I have this command in the clips file – (printout t “Hello World’ crlf) on the RHS of a rule. Would it be possible to get this output “Hello World” on the web page?

 

I had tried the following. The example I had were pretty similar to the TekMart from the book Jess in Action. I have the same BaseServlet to initialize the Rete object and to make a batch call to the clips file.

 

Then I have another servlet, say TestRequest

 

checkInitialized();

                  

          ServletContext servletContext = getServletContext();

          Rete engine = (Rete) servletContext.getAttribute("engine");

                                               

          StringWriter sw = new StringWriter();

          engine.addOutputRouter("t", sw);

                  

          String myString = sw.toString();              

          request.setAttribute("testString", myString);

                  

          dispatch(request, response, "/test.jsp");

 

on test.jsp, I have

 

<%= request.getAttribute("testString").toString() %>

 

Does any of the above make sense?

 

Thanks.

 

Anthony

 

Reply via email to