You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Anders Kofoed <an...@avaleo.net> on 2006/12/19 13:31:51 UTC

[Jelly] Exiting a jelly script w/wo exitcode

Hi Jelly users,

I'm a newbie to Jelly script and are in the process of evaluating Jelly 
script for future use in deployment of our systems.

Question: How to I exit a jelly-script if want to - maybe with an exit 
status (like exit(0);) ?

A snippet of the my test script:

  <j:catch var="exception">
    <h:get uri="http://test-server1/" var="web1"/>
  </j:catch>
  <j:if test="${exception != null}">
    Connect failed!
    //*exit(0);*
  </j:if>

How do I exit if connection fails ?

Kind rgds
Anders Kofoed


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


Re: [Jelly] Exiting a jelly script w/wo exitcode

Posted by Paul Libbrecht <pa...@activemath.org>.
Remember, remember... java-under-the-hood!
var="0" is not useful by the way.

paul

Anders Kofoed wrote:
> Thanks for your fast replies
>
> I did consider the break method, but I need something that will exit 
> completely.
>
> It worked using the invokeStatic !
>
>    <j:invokeStatic className="java.lang.System" method="exit" var="0">
>      <j:arg type="int" value="0"/>
>    </j:invokeStatic>
>
> Thanks Paul (and Mark)
>
> Kind rgds
> Anders
>
>
>
>
> Anders Kofoed wrote:
>> Hi Jelly users,
>>
>> I'm a newbie to Jelly script and are in the process of evaluating 
>> Jelly script for future use in deployment of our systems.
>>
>> Question: How to I exit a jelly-script if want to - maybe with an 
>> exit status (like exit(0);) ?
>>
>> A snippet of the my test script:
>>
>>  <j:catch var="exception">
>>    <h:get uri="http://test-server1/" var="web1"/>
>>  </j:catch>
>>  <j:if test="${exception != null}">
>>    Connect failed!
>>    //*exit(0);*
>>  </j:if>
>>
>> How do I exit if connection fails ?

Re: [Jelly] Exiting a jelly script w/wo exitcode

Posted by Anders Kofoed <an...@avaleo.net>.
Thanks for your fast replies

I did consider the break method, but I need something that will exit 
completely.

It worked using the invokeStatic !

    <j:invokeStatic className="java.lang.System" method="exit" var="0">
      <j:arg type="int" value="0"/>
    </j:invokeStatic>

Thanks Paul (and Mark)

Kind rgds
Anders




Anders Kofoed wrote:
> Hi Jelly users,
>
> I'm a newbie to Jelly script and are in the process of evaluating 
> Jelly script for future use in deployment of our systems.
>
> Question: How to I exit a jelly-script if want to - maybe with an exit 
> status (like exit(0);) ?
>
> A snippet of the my test script:
>
>  <j:catch var="exception">
>    <h:get uri="http://test-server1/" var="web1"/>
>  </j:catch>
>  <j:if test="${exception != null}">
>    Connect failed!
>    //*exit(0);*
>  </j:if>
>
> How do I exit if connection fails ?
>
> Kind rgds
> Anders Kofoed
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>

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


Re: [Jelly] Exiting a jelly script w/wo exitcode

Posted by Mark Tombs <ma...@gmail.com>.
One way of doing something similar is to put a j:forEach around the whole
script, and then use j:break to jump out of the loop, but then you don't get
an exit code. The forEach should only loop once of course :)

/mark


On 12/19/06, Paul Libbrecht <pa...@activemath.org> wrote:
>
> Anders,
>
> there's no tag for that, it would be easy to make, but you use
> invokeStatic tag for this in the meantime, or?
>
> paul
>
> Anders Kofoed wrote:
> > Hi Jelly users,
> >
> > I'm a newbie to Jelly script and are in the process of evaluating
> > Jelly script for future use in deployment of our systems.
> >
> > Question: How to I exit a jelly-script if want to - maybe with an exit
> > status (like exit(0);) ?
> >
> > A snippet of the my test script:
> >
> >  <j:catch var="exception">
> >    <h:get uri="http://test-server1/" var="web1"/>
> >  </j:catch>
> >  <j:if test="${exception != null}">
> >    Connect failed!
> >    //*exit(0);*
> >  </j:if>
> >
> > How do I exit if connection fails ?
> >
> > Kind rgds
> > Anders Kofoed
>
>
>
>

Re: [Jelly] Exiting a jelly script w/wo exitcode

Posted by Paul Libbrecht <pa...@activemath.org>.
Anders,

there's no tag for that, it would be easy to make, but you use 
invokeStatic tag for this in the meantime, or?

paul

Anders Kofoed wrote:
> Hi Jelly users,
>
> I'm a newbie to Jelly script and are in the process of evaluating 
> Jelly script for future use in deployment of our systems.
>
> Question: How to I exit a jelly-script if want to - maybe with an exit 
> status (like exit(0);) ?
>
> A snippet of the my test script:
>
>  <j:catch var="exception">
>    <h:get uri="http://test-server1/" var="web1"/>
>  </j:catch>
>  <j:if test="${exception != null}">
>    Connect failed!
>    //*exit(0);*
>  </j:if>
>
> How do I exit if connection fails ?
>
> Kind rgds
> Anders Kofoed