I want to embed jess in JSP but have some problems
Jess reported an error in routine Context.getVariable
while executing (printout page ?ans crlf). Message: No such variable ans.
Program text: ( printout page ?ans crlf ) at line 1.
Thank you
<%@ page contentType="text/html; charset=big5"
language="java" %>
<%@ page import="jess.*" %> <jsp:useBean id="engine" class="jess.Rete" scope="request"/> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=big5"> <title>Welcome Jess</title> </head> <body>
<% try { engine.executeCommand("(deftemplate input (slot num (default 0)))"); engine.executeCommand("(defrule assert-facts => (assert (input (num 4))))"); engine.executeCommand("(defrule rule01 (input (num 4)) => (bind ?ans" + "rule01" +"))"); engine.addOutputRouter("page", out); engine.executeCommand("(printout page ?ans crlf)"); } catch (JessException ex) { out.println(ex); } %> </body> </html> |