cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Gallardo" <agalla...@agssa.net>
Subject RE: jx:when test does not match - similar problem
Date Fri, 19 Nov 2004 21:30:51 GMT
H.vanderLinden@MI.unimaas.nl dijo:
> Hi,
>
> I have a similar problem. I hope someone has the correct syntax:
>
> <jx:set var="myVar" value="BLAH-1"/>
> <jx:set var="lastDigit" value="${myVar.substring(myvar.length() - 1)}/>
>
> ${lastDigit} should be "1", but is empty.
>
> Does anyone know what's wrong?

OK. I will check this one now... :-)
>
> Thanks.

You are welcome! :-D

>
> Bye, Helma

Best Regards,

Antonio Gallardo
>
>> -----Original Message-----
>> From: Antonio Gallardo [mailto:agallardo@agssa.net]
>> Sent: Friday, 19 November 2004 19:46
>> To: users@cocoon.apache.org
>> Subject: Re: jx:when test does not match
>>
>>
>> Hi Thorsten:
>>
>> 2 points:
>>
>> 1- Make sure the variable is filled. Try:
>> <jx:out value="${anrede.trim()}"/>
>>
>> 2-Remember this is a String so, you need to use .equal() for
>> testing a match:
>>
>> <jx:out value="${anrede.equals('Herr')}"/>
>>
>> Best Regards,
>>
>> Antonio Gallardo
>>
>>
>> Thorsten Scherler dijo:
>> > Hello list I have following problem:
>> >
>> > <jx:set var="anrede"><session:getxml context="authentication"
>> > path="/authentication/data/User/Salutation"/></jx:set>
>> >
>> > I create a variable anrede (Herr|Frau). Then I want to test
>> whether the
>> > variable value is Herr or Frau like the following, but the first
>> > condition is always true (and I do not know why):
>> >
>> >        <jx:choose>
>> >          <jx:when test="${anrede != 'Herr'}">
>> >            Sehr geehrte ${anrede} <session:getxml
>> > context="authentication"
>> path="/authentication/data/User/LastName"/>,
>> >          </jx:when>
>> >          <jx:otherwise>
>> >            Sehr geehrter ${anrede} <session:getxml
>> > context="authentication"
>> path="/authentication/data/User/LastName"/>,
>> >          </jx:otherwise>
>> >        </jx:choose>.
>> >
>> > 1<jx:out value="${anrede.trim() == ' Herr '}"/>1
>> > 2<jx:out value="${anrede}.trim() == 'Herr'"/>2
>> > 3<jx:out value="${anrede.contain('Herr')}"/>3
>> > 4<jx:out value="${anrede}.equal('Herr')"/>4
>> > 1<jx:out value="${anrede != ' Herr '}"/>5
>> >
>> > gives:
>> > Sehr geehrte Herr Wechner,
>> >
>> > 1false1
>> > 2Herr2
>> > 33
>> > 4Herr4
>> > 1true5
>> >
>> > Anybody has a clue why it is not matching?
>> >
>> > TIA
>> > --
>> > thorsten
>> >
>> > "Together we stand, divided we fall"
>> > Hey you (Pink Floyd)
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> > For additional commands, e-mail: users-help@cocoon.apache.org
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message