You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Christian Sell <ch...@netcologne.de> on 2003/01/22 17:08:28 UTC

[jelly] echo tag

Hello,

I just wrote a script using the <j:echo message="dada"/> tag, which I 
assumed was certainly available in core - but alas! Nowhere.

What about having that?

And what about some tag to enforce availability of variables, for 
example if a script requires parameters to be set before invoking it?

- Christian


Re: [jelly] echo tag

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "Christian Sell" <ch...@netcologne.de>
> No thanks. I knew there were lots of complicated ways to do the very 
> simple thing I had in mind. But all of them amount to 
> learning/configuring tag libraries that otherwise do tons of things I 
> have not the least interest in.
> 
> The reason why I use a script language is because it should make things 
> simple. I must say that currently Jelly has a lot of functionality, but 
> it does not do a very good job at the simple things.

To just output some text, just type it in 

<foo>
    hello there ${user.name}
</foo>

There's no real need to use a custom tag to output stuff.

James
-------
http://radio.weblogs.com/0112098/
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Re: [jelly] echo tag

Posted by Christian Sell <ch...@netcologne.de>.
Martin Cooper wrote:
> 
> On Wed, 22 Jan 2003, Christian Sell wrote:
> 
> 
>>Paul Libbrecht wrote:
>>
>>>It does it does !
>>>
>>>But what is an echo supposed to do ?
>>
>>what it has been doing all the time (in any OS shell language). Just put
>>out a string and a carriage return to the console.
> 
> 
> Console? Who says there's a console? If I'm running code as a Win2K
> service, where is my console?

huh? I still want to quickly write a message to the console. Right now I 
dont care about people who want to run their Jelly scripts as Win2K 
services.

> 
> --
> Martin Cooper
> 
> 
> 
>>>Honestly, there are at least five ways !!
>>
>>as I said, think of the simple things first.
>>
>>
>>>Paul
>>>
>>>
>>>Le mercredi, 22 jan 2003, à 17:49 Europe/Paris, Christian Sell a écrit :
>>>
>>>
>>>>The reason why I use a script language is because it should make
>>>>things simple. I must say that currently Jelly has a lot of
>>>>functionality, but it does not do a very good job at the simple > things.
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><ma...@jakarta.apache.org>
>>>For additional commands, e-mail:
>>><ma...@jakarta.apache.org>
>>>
>>>
>>
>>
>>--
>>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 



Re: [jelly] echo tag

Posted by Martin Cooper <ma...@apache.org>.

On Wed, 22 Jan 2003, Christian Sell wrote:

> Paul Libbrecht wrote:
> > It does it does !
> >
> > But what is an echo supposed to do ?
>
> what it has been doing all the time (in any OS shell language). Just put
> out a string and a carriage return to the console.

Console? Who says there's a console? If I'm running code as a Win2K
service, where is my console?

--
Martin Cooper


>
> > Honestly, there are at least five ways !!
>
> as I said, think of the simple things first.
>
> >
> > Paul
> >
> >
> > Le mercredi, 22 jan 2003, à 17:49 Europe/Paris, Christian Sell a écrit :
> >
> >> The reason why I use a script language is because it should make
> >> things simple. I must say that currently Jelly has a lot of
> >> functionality, but it does not do a very good job at the simple > things.
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


Re: [jelly] echo tag

Posted by Paul Libbrecht <pa...@activemath.org>.
But why is the following complicated ?

<j:jelly>
         xmlns:j         ="jelly:core"
         xmlns:log       ="jelly:log">

	<log:info>Hello World!</log:info>
	
   </j:jelly>


Or maybe, you may be missing the hello-world:

<j:jelly> xmlns:j="jelly:core">Hello World!</jelly>

Paul


Le mercredi, 22 jan 2003, à 18:03 Europe/Paris, Christian Sell a écrit :

> what it has been doing all the time (in any OS shell language). Just 
> put out a string and a carriage return to the console.


Re: [jelly] echo tag

Posted by Christian Sell <ch...@netcologne.de>.
Paul Libbrecht wrote:
> It does it does !
> 
> But what is an echo supposed to do ?

what it has been doing all the time (in any OS shell language). Just put 
out a string and a carriage return to the console.

> Honestly, there are at least five ways !!

as I said, think of the simple things first.

> 
> Paul
> 
> 
> Le mercredi, 22 jan 2003, à 17:49 Europe/Paris, Christian Sell a écrit :
> 
>> The reason why I use a script language is because it should make 
>> things simple. I must say that currently Jelly has a lot of 
>> functionality, but it does not do a very good job at the simple > things.
> 
> 
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 
> 



Re: [jelly] echo tag

Posted by Paul Libbrecht <pa...@activemath.org>.
It does it does !

But what is an echo supposed to do ?
Honestly, there are at least five ways !!

Paul


Le mercredi, 22 jan 2003, à 17:49 Europe/Paris, Christian Sell a écrit :

> The reason why I use a script language is because it should make 
> things simple. I must say that currently Jelly has a lot of 
> functionality, but it does not do a very good job at the simple > things.

Re: [jelly] echo tag

Posted by Christian Sell <ch...@netcologne.de>.
No thanks. I knew there were lots of complicated ways to do the very 
simple thing I had in mind. But all of them amount to 
learning/configuring tag libraries that otherwise do tons of things I 
have not the least interest in.

The reason why I use a script language is because it should make things 
simple. I must say that currently Jelly has a lot of functionality, but 
it does not do a very good job at the simple things.


James Strachan wrote:
> From: "Christian Sell" <ch...@netcologne.de>
> 
>>Hello,
>>
>>I just wrote a script using the <j:echo message="dada"/> tag, which I
>>assumed was certainly available in core - but alas! Nowhere.
>>
>>What about having that?
> 
> 
> There's an <echo> tag in the Ant tag library which uses Ant's EchoTask.
> 
> Or the log tag library uses commons-logging (so you can log to log4j, JDK
> 1.4 logging or logkit)
> 
>     <log:info> this is some text ${customer.name} </log:info>
> 
>     <log:warn> I can contain other tags if I wish <j:useBean var="b"
> class="Foo"/> ${b.getSomething()} </log:warn>
> 
> 
>>And what about some tag to enforce availability of variables, for
>>example if a script requires parameters to be set before invoking it?
> 
> 
> You could use the assertions from the JUnit library...
> 
> <test:assert test="${foo != null}"/>
> <test:assert test="${bar != null}">You must define the bar attribute to run
> this script</test:assert>
> 
> Though if this doesn't quite match your requirements I'm sure another
> similar kind of tag could be created.
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 



Re: [jelly] echo tag

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "Christian Sell" <ch...@netcologne.de>
> Hello,
>
> I just wrote a script using the <j:echo message="dada"/> tag, which I
> assumed was certainly available in core - but alas! Nowhere.
>
> What about having that?

There's an <echo> tag in the Ant tag library which uses Ant's EchoTask.

Or the log tag library uses commons-logging (so you can log to log4j, JDK
1.4 logging or logkit)

    <log:info> this is some text ${customer.name} </log:info>

    <log:warn> I can contain other tags if I wish <j:useBean var="b"
class="Foo"/> ${b.getSomething()} </log:warn>


> And what about some tag to enforce availability of variables, for
> example if a script requires parameters to be set before invoking it?

You could use the assertions from the JUnit library...

<test:assert test="${foo != null}"/>
<test:assert test="${bar != null}">You must define the bar attribute to run
this script</test:assert>

Though if this doesn't quite match your requirements I'm sure another
similar kind of tag could be created.

James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Re: [jelly] echo tag

Posted by Paul Libbrecht <pa...@activemath.org>.
You have many ways to do that !!

The log tag-library is certainly your friend, it is invoked every-time 
the element is being run.

If you put any text, it will be output to XML-output.

And at worst (at dirtiest) you can use 
${java.lang.System.out.println("Blop")} (I think).

Paul


Le mercredi, 22 jan 2003, à 17:08 Europe/Paris, Christian Sell a écrit :

> I just wrote a script using the <j:echo message="dada"/> tag, which I 
> assumed was certainly available in core - but alas! Nowhere.
>
> What about having that?


Re: [jelly] echo tag

Posted by Christian Sell <ch...@netcologne.de>.
> How about
> 
>     <j:stdout newline="true">this is some text</j:stdout>
>     <j:stderr newline="false">this is some text</j:stderr>
> 

not bad..

> 
>>where the above attributes show all the default values, so that they can
>>be ommitted, yielding this effect:
>>
>>System.out.println("this is a message");
> 
> 
> Just an idle observation, you could declare System.out and System.err as
> variables, then just do
> 
> ${out.println('some text')}
> ${err.println('some text')}


certainly. I guess I could do almost anything I can do in Java. But 
then, whats the point of a scripting language?

And yes (to the other poster) I can reconfigure Log4J, and finally 
somehow and sometime get there.


Re: [jelly] echo tag

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "Christian Sell" <ch...@netcologne.de>
> > what exactly would it look like? i.e. what do you
> > want to type in your Jelly scripts?
>
> <j:echo stdout="true" stderr="false" xmlout="false" endcr="true">this is
> a message</j:echo>

How about

    <j:stdout newline="true">this is some text</j:stdout>
    <j:stderr newline="false">this is some text</j:stderr>


> where the above attributes show all the default values, so that they can
> be ommitted, yielding this effect:
>
> System.out.println("this is a message");

Just an idle observation, you could declare System.out and System.err as
variables, then just do

${out.println('some text')}
${err.println('some text')}

James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Re: [jelly] echo tag

Posted by Christian Sell <ch...@netcologne.de>.
James Strachan wrote:
> So doing this
> 
> <j:jelly xmlns:j="jelly:core" trim="false">
> 
>     this will appear on the console as
>     text
> 
>     with carriage returns etc
> </j:jelly>
> 
> should do what you need.

I have attached 2 files:

1. amended suite.jelly which includes a test that demonstrates the 
effect where expressions seem to mess up content handling/trimming

2. a simple script which does the same as above, plus demonstrate how 
the output from <log> tags gets arbitrarily interspersed with the output 
from tag content.

> 
> Just forgetting whats in Jelly right now - lets for now assume you could
> have anything you want - 

is that not so?

> what exactly would it look like? i.e. what do you
> want to type in your Jelly scripts?

<j:echo stdout="true" stderr="false" xmlout="false" endcr="true">this is 
a message</j:echo>

where the above attributes show all the default values, so that they can 
be ommitted, yielding this effect:

System.out.println("this is a message");

> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


Re: [jelly] echo tag

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "Christian Sell" <ch...@netcologne.de>
> Martin Cooper wrote:
> >
> > On Thu, 23 Jan 2003 dion@multitask.com.au wrote:
> >
> >
> >>I was thinking about this also, and thought about the 'out' tag from the
> >>jsp standard taglib....?
> >>
> >>Comments?
> >
> >
> > This would write to the Jelly output stream, though, not to the console,
> > wouldn't it? At least, that's what I would expect it to do. I don't
> > believe that's what Christian is looking for.
>
> right. The same goes for the <whitespace>dada</whitespace> suggestion,
> too. Besides, it looks rather awkward to write
>
> <whitespace>dada
> </whitespace>
>
> to get a carriage return at the end.

First off, the output of the Jelly script is often piped to the console. So
just like Velocity, JSP or XSP, you just add text with whitespace and it
should come out. (Admittedly you've found a wierd case where whitespace is
coming out funny which we'll fix).

So doing this

<j:jelly xmlns:j="jelly:core" trim="false">

    this will appear on the console as
    text

    with carriage returns etc
</j:jelly>

should do what you need.

Just forgetting whats in Jelly right now - lets for now assume you could
have anything you want - what exactly would it look like? i.e. what do you
want to type in your Jelly scripts?

James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Re: [jelly] echo tag

Posted by Christian Sell <ch...@netcologne.de>.
Martin Cooper wrote:
> 
> On Thu, 23 Jan 2003 dion@multitask.com.au wrote:
> 
> 
>>I was thinking about this also, and thought about the 'out' tag from the
>>jsp standard taglib....?
>>
>>Comments?
> 
> 
> This would write to the Jelly output stream, though, not to the console,
> wouldn't it? At least, that's what I would expect it to do. I don't
> believe that's what Christian is looking for.

right. The same goes for the <whitespace>dada</whitespace> suggestion, 
too. Besides, it looks rather awkward to write

	<whitespace>dada
</whitespace>

to get a carriage return at the end.

> 
> --
> Martin Cooper
> 
> 
> 
>>--
>>dIon Gillard, Multitask Consulting
>>Blog:      http://www.freeroller.net/page/dion/Weblog
>>Work:      http://www.multitask.com.au
>>
>>
>>Christian Sell <ch...@netcologne.de> wrote on 23/01/2003 03:08:28
>>AM:
>>
>>
>>>Hello,
>>>
>>>I just wrote a script using the <j:echo message="dada"/> tag, which I
>>>assumed was certainly available in core - but alas! Nowhere.
>>>
>>>What about having that?
>>>
>>>And what about some tag to enforce availability of variables, for
>>>example if a script requires parameters to be set before invoking it?
>>>
>>>- Christian
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>
>><ma...@jakarta.apache.org>
>>
>>>For additional commands, e-mail:
>>
>><ma...@jakarta.apache.org>
>>
>>>ForwardSourceID:NT000A6C8A
>>
>>--
>>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 



Re: [jelly] echo tag

Posted by Martin Cooper <ma...@apache.org>.

On Thu, 23 Jan 2003 dion@multitask.com.au wrote:

> I was thinking about this also, and thought about the 'out' tag from the
> jsp standard taglib....?
>
> Comments?

This would write to the Jelly output stream, though, not to the console,
wouldn't it? At least, that's what I would expect it to do. I don't
believe that's what Christian is looking for.

--
Martin Cooper


> --
> dIon Gillard, Multitask Consulting
> Blog:      http://www.freeroller.net/page/dion/Weblog
> Work:      http://www.multitask.com.au
>
>
> Christian Sell <ch...@netcologne.de> wrote on 23/01/2003 03:08:28
> AM:
>
> > Hello,
> >
> > I just wrote a script using the <j:echo message="dada"/> tag, which I
> > assumed was certainly available in core - but alas! Nowhere.
> >
> > What about having that?
> >
> > And what about some tag to enforce availability of variables, for
> > example if a script requires parameters to be set before invoking it?
> >
> > - Christian
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
>
> > ForwardSourceID:NT000A6C8A
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


Re: [jelly] echo tag

Posted by di...@multitask.com.au.
I was thinking about this also, and thought about the 'out' tag from the 
jsp standard taglib....?

Comments?
--
dIon Gillard, Multitask Consulting
Blog:      http://www.freeroller.net/page/dion/Weblog
Work:      http://www.multitask.com.au


Christian Sell <ch...@netcologne.de> wrote on 23/01/2003 03:08:28 
AM:

> Hello,
> 
> I just wrote a script using the <j:echo message="dada"/> tag, which I 
> assumed was certainly available in core - but alas! Nowhere.
> 
> What about having that?
> 
> And what about some tag to enforce availability of variables, for 
> example if a script requires parameters to be set before invoking it?
> 
> - Christian
> 
> 
> --
> To unsubscribe, e-mail: 
<ma...@jakarta.apache.org>
> For additional commands, e-mail: 
<ma...@jakarta.apache.org>
> 

> ForwardSourceID:NT000A6C8A