- Object resp;
- try {
- ip.set("req", req);
- resp = ip.eval(cmd);
- out.println("<pre>");
- out.println(Misc.htmlq((resp == null)?"(null)":(resp.toString())));
- out.println("</pre>");
- } catch(bsh.EvalError exc) {
- out.println("<h2>Evaluation error</h2>");
- out.println("<pre>");
- out.print(exc.toString());
- out.println("</pre>");
- if(exc instanceof bsh.TargetError) {
- bsh.TargetError te = (bsh.TargetError)exc;
- out.println("<h3>Target error</h3>");
- out.println("<pre>");
- te.getTarget().printStackTrace(out);
- out.println("</pre>");
- }
+ ip.set("req", req);
+ resp = ip.eval(cmd);
+ buf.insert("body", buf.el("pre", buf.text((resp == null)?"(null)":(resp.toString()))));
+ } catch(bsh.EvalError exc) {
+ buf.insert("body", buf.el("h2", buf.text("Evaluation error")));
+ buf.insert("body", buf.el("pre", buf.text(exc.toString())));
+ if(exc instanceof bsh.TargetError) {
+ bsh.TargetError te = (bsh.TargetError)exc;
+ buf.insert("body", buf.el("h3", buf.text("Target error")));
+ StringWriter sbuf = new StringWriter();
+ te.getTarget().printStackTrace(new PrintWriter(sbuf));
+ buf.insert("body", buf.el("pre", buf.text(sbuf.toString())));