You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Reinaldo Barreiro, E." <e....@TUE.nl> on 2003/11/25 14:01:48 UTC

to the developers of Jelly

Hi All,

I hope this is the correct list to send this e-mail. 

I have installed Jelly and perused a bit the source code and documentation. 
I'm planning to use it for one of our projects... Well the question I want to ask is: 

Is it possible to define your own functions on a Jelly tag library (the same 
way it is possible on JSP 2.0)? Like in:

<j:jelly xmlns:c="jelly:core" xmlns:foo="jelly:FooTagLibrary">
    <c:if test="${foo:myfunction(param.value)}">
        ${param.value}
    </c:if>                
</j:jelly>

In my view that is a very powerfull feature of JSP 2.0. and it would be 
nice to have it in Jelly. My apologies to the developers if the feature is 
already there and I didn't mangage to find how to use it.

Best regards,

Ernesto Reinaldo Barreiro 


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


Re: to the developers of Jelly

Posted by Paul Libbrecht <pa...@activemath.org>.
Hi Ernesto!

I am not sure I do understand what it means to invoke a function of a 
tag-library at least in Jelly. From what I understood from the first 
answer to your question, it looks like straight invocation would do.

How about the following ?
<j:jelly xmlns:c="jelly:core">
   <j:new className="jelly.FooTagLibrary: var="instance"/>
   ${instance.doSomething()}
  </j:jelly>

TagLibraries in Jelly are instantiated objects which are closer to 
"tag-factories"... so it's kind of not compatible to your usage. But 
there's large freedom in creating and manipulating object, always being 
possible to output some XML content through SAX events.

Paul




Reinaldo Barreiro, E. wrote:
> I hope this is the correct list to send this e-mail. 
> 
> I have installed Jelly and perused a bit the source code and documentation. 
> I'm planning to use it for one of our projects... Well the question I want to ask is: 
> 
> Is it possible to define your own functions on a Jelly tag library (the same 
> way it is possible on JSP 2.0)? Like in:
> 
> <j:jelly xmlns:c="jelly:core" xmlns:foo="jelly:FooTagLibrary">
>     <c:if test="${foo:myfunction(param.value)}">
>         ${param.value}
>     </c:if>                
> </j:jelly>
> 
> In my view that is a very powerfull feature of JSP 2.0. and it would be 
> nice to have it in Jelly. My apologies to the developers if the feature is 
> already there and I didn't mangage to find how to use it.


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


Re: to the developers of Jelly

Posted by Robert <ro...@bull-enterprises.com>.
I am not a committer, but I have been using Jelly for quite some time 
and I do not believe this is yet possible. Having said that, there are a 
couple of options here.

The first is that you can create your own tags, much like you can create 
your own JSP tags. See: 
http://jakarta.apache.org/commons/jelly/overview.html

The second is that you can create tags using Jelly itself using the 
'define' taglibrary. I have not done this myself but I just looked at 
the CVS source and there are examples in the unit tests for doing this.

A third option is to use the invokeStatic jelly tag. Since JSP 2.0 
functions are public static methods, you can use your JSP function class 
in Jelly. For for your example, it would look like:

<j:invokeStatic var="testValue" method="myfunction" 
className="my.FunctionClass">
	<j:arg value="${param.value}" />
</j:invokeStatic>
<j:if test="${testValue}">
  ... do something.
</j:if>

Not the same syntax, but the same results.

Robert McIntosh

Reinaldo Barreiro, E. wrote:
> Hi All,
> 
> I hope this is the correct list to send this e-mail. 
> 
> I have installed Jelly and perused a bit the source code and documentation. 
> I'm planning to use it for one of our projects... Well the question I want to ask is: 
> 
> Is it possible to define your own functions on a Jelly tag library (the same 
> way it is possible on JSP 2.0)? Like in:
> 
> <j:jelly xmlns:c="jelly:core" xmlns:foo="jelly:FooTagLibrary">
>     <c:if test="${foo:myfunction(param.value)}">
>         ${param.value}
>     </c:if>                
> </j:jelly>
> 
> In my view that is a very powerfull feature of JSP 2.0. and it would be 
> nice to have it in Jelly. My apologies to the developers if the feature is 
> already there and I didn't mangage to find how to use it.
> 
> Best regards,
> 
> Ernesto Reinaldo Barreiro 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 



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