commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: [Jelly] how do I to embed jelly variables and reserved chars in xml
Date Fri, 12 Dec 2003 02:20:39 GMT
Scott Walters <> wrote on 12/12/2003 12:18:48 PM:

> Hi,
> I'm trying very hard to figure how to embed jelly variables in xml.  One 

> purpose is to generate a jelly script with another jelly script.

Generating a script is easy. You may want to look at the xml taglib, and 
in particular the xml:element tag.


You could then import or include that script.

> The general idea with is that I have a taglib built with the define 
> library.  I'd like to generate jelly code to call these taglib 
> functions.  Instead of calling <manager:testTag> directly, I end up with 

> something like this...
> <j:set var="taglib" value="manager"/>
> <j:set var="tag" value="testTag"/>
> <${taglib:tag}/>
> This causes parse errors.  I've also tried this...
> <"${taglib:tag}"/>

A jelly script MUST be valid XML. The above options aren't.

> I also tried enclosing all of the above inside a core:parse tag. This 
> threw a null ptr exception which appeared to be caused by the creation 
> of the XMLOutput object with the empty ctor in the method below from 
>  When the downstream sax method tried to use it, it's 
> content handler was null.  I attempted a fix by passing in the handler 
> variable from the previous line, which fixed the npe but didn't fix by 
> embedded variable problem.

This looks like a bug in core:parse.


> I also want to embed some javascript in the output but I have 2 problems 

> here.
> First, I haven't been able to figure out how use < or > in an 
> expression, If I put them in as-is, I get parse errors, if I escape 
> them, the javascript doesn't run.

Can you give us a sample? Using CDATA blocks or &lt; or &gt; should work.

> Second, I can't get newline characters into the javascript. It all comes 

> out as one big line.  I've tried putting &#13;&#10; after each line, and 

> switching the trim and escapeText options on the <core:file> tag that 
> the html is enclosed in, which I use to put the body text into a jelly 
> variable that the parent tag sends to the servlet output stream.
Text trimming in Jelly is a pain, and a sample of what you're doing will 
help us work out the issue.

dIon Gillard, Multitask Consulting

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message