Matt Raible wrote:

To be honest, I haven't tried.  I imagine it would be somewhat simple
though.  However, since I really know nothing about OGNL, it might be a
lot more difficult than I'm thinking. To add JSTL Support, I simply
subclassed the two Table and Column Tags and added an
ExpressionEvaluator to do the evaluation of Strings.

http://displaytag.sourceforge.net/xref/org/displaytag/tags/el/package-su
mmary.html

The one ugly issue right now is we are maintaining a separate TLD for
the original tag library and the EL version. I suppose we could use
XDoclet to generate this and that might solve the problem, but I imagine
the main developers are little hesitant to adding another TLD to the
mix. That being said, I'm more than willing to hack a local copy and
make this work.


I think if I do this same sort of logic (see below) with OGNL - it'll be
a breeze.

ExpressionEvaluator eval = new ExpressionEvaluator(this, pageContext);
if ((s = eval.evalString("decorator", _decorator)) != null)
{
   super.setDecorator(s);
}

... Replacing Expression Evaluation with one from OGNL...



This is certainly possible. The ExpressionEvaluator is equivalent to an OgnlContext. The different would be that EL and the internal expression language implictly have the "pageScope", etc. variables available. OGNL would have to account for this before executing the expression against a root object. It shouldn't be too hard to account for it,. however, since you are using it in a rather controlled circumstance.

I'll look a the code and see what I can come up with. In my own code I've allowed expressions by just having the attribute text parsed internally to the tag, not by the templating engine. For example:

   <display:table>
      <display:column property="[ address.street ]" title="Street"/>
   </display>

OGNL also supports compiling expressions, which might make more sense than just evaluating a string each time. The expression can be cached for future evaluation that way.

The brackets would delimit the expression and also denote that it's an OGNL expression. I don't know if this would work or if it's feasible but it would alleviate having to come up with an entirely different TLD for the taglib.

I'm going to give this a shot with OGNL 3. If it works I'll let you know and we can discuss how to integrate it back into displaytag if you want.

- Drew

--
+---------------------------------+
< Drew Davidson | OGNL Technology >
<     Professional Open Source    >
+---------------------------------+
|  Email: [EMAIL PROTECTED]          /
|    Web: http://www.ognl.org   /
|    Vox: (520) 531-1966       <
|    Fax: (520) 531-1965        \
| Mobile: (520) 405-2967         \
+---------------------------------+




------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ displaytag-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to