+ private class InputTag implements Node.Stream.Functor {
+ final String fieldName;
+ public InputTag(String fieldName) { this.fieldName = fieldName; }
+ public Node.Stream wrap(Node.Stream kids) {
+ try {
+ return new Node.Stream.FromXML(new StringReader(servletscope.currentForm.emit(fieldName)));
+ } catch (Exception e) { Log.warn(this, e); return null; }
+ }
+ }
+
+ private class FormTag implements Node.Stream.Functor {
+ final String classname;
+ public FormTag(String classname) { this.classname = classname; }
+ public Node.Stream wrap(final Node.Stream kids) {
+ try {
+ servletscope.currentForm = (Form)Class.forName(classname).newInstance();
+ Log.warn("emit", servletscope.currentForm.emit());
+ return new Node.Stream() {
+ boolean done = false;
+ public boolean _read(Node n) {
+ if (done) return kids._read(n);
+ done = true;
+ n.clear();
+ n.name = "form";
+ n.uri = "http://www.w3.org/1999/xhtml";
+ n.numattrs = 1;
+ n.attrs = new String[] { "action", "/servlet/"+classname };
+ return true;
+ }
+ };
+ } catch (Exception e) {
+ Log.warn(this, e);
+ return null;
+ }
+ } }
+