You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Bill Keese <bi...@tech.beacon-it.co.jp> on 2003/05/21 10:54:01 UTC

Re: [jelly] dynamically generated variable names / xpath xpressions (context bug)

> <j:set var="id" value="T1234"/>
> ${context.findVariable(id)}
> -- "bob mcwhirter" <bo...@werken.com>

Thanks!  This is works in general, but doesn't work from  a user defined
tag.

When a user-defined tag runs, the context variable is set to null.  You can
reference a variable like ${t1} but if I say ${context.getVariable(...)} it
doesn't work (because context is set to null)

The problem seems to be that newJellyContext(Map newVariables) creates a
JellyContext where the "context" variable is undefined .  (The JellyContext
constructor sets this variable, but it is then erased when newVariables
overwrites variables.)

This is a bug, right?

Bill


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jelly] threads & xmlOutput

Posted by Bill Keese <bi...@tech.beacon-it.co.jp>.
By default, the <thread> tag creates it's own XMLOutput object, writing to
System.out, rather than using the caller's XMLOutput object.  (The XMLOutput
argument to doTag() is ignored.)  I think the default should be to use the
caller's XMLOutput object.

For example, the following program has two XMLOutput objects, both writing
to System.out, but due to buffering inside the XMLOutput class, the output
gets garbled:

Code:
  <hello>
      <threads:thread var="myThread">
           <world/>
      </threads:thread>
       <threads:join thread="${myThread}"/>
   </hello>

Output:
   <world><world/><hello></hello>

Output I want:
  <hello>
      <world></world>
  </hello>

Of course, anytime you have multiple objects writing to the same xmlOutput
stream, you need to be careful, and do synchronization, in order to make
sure that you produce a valid XML document.

Comments?

Also, is there any way to get access to the current xmlOutput stream?  Then
I could workaround by doing something like
     <threads:thread var="myThread" xmlOutput="${getCurrentXMLOutput()}">

But I can't find a function like that.

Bill


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org