struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Li Ying <>
Subject Re: If tag expression problem
Date Fri, 08 Oct 2010 09:57:15 GMT
I think there is a type mismatch too.

Converting the array [pages] to strings should work,

can you post your code, show us how you convert it?

Or, you can try this:

<s:if test="#it.toString() == #parameters['page']">

see if it works.

2010/10/8 Darren Karstens <>:
> Hi,
> I have the following code that displays a list of page numbers that
> all have links except for the current page (defined by the request
> parameter 'page'):
> <s:iterator value="pages" var="it">
>  <s:if test="#it==#parameters['page']">
>    <s:property />
>  </s:if>
>  <s:else>
>    <a href="/jwg-struts/create/displayCards.action?page=<s:property
> />"><s:property /></a>
>  </s:else>
> </s:iterator>
> However this doesn't work and the if condition is alway false. I tried
> outputting the value of #it in each itteration and got the correct
> values (numbers 1-5) and done the same with the #parameters['page']
> and got the number 2. I also tried substituting the if tag for <s:if
> test="#it==2"> and this worked!! The pages array in the action was an
> array of ints so I thought maybe there is a type mismatch since the
> request parameter would be a string so I tried converting the array to
> strings but still no luck. Is this if tag valid? Can anyone tell me
> where im going wrong?
> Regards,
> Darren
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message